Class Messages.MessageChainBuilder

java.lang.Object
io.smallrye.reactive.messaging.Messages.MessageChainBuilder
Enclosing interface:
Messages

public static class Messages.MessageChainBuilder extends Object
The message chain builder allows chaining message and configure metadata propagation. By default, all the metadata from the given message are copied into the chained messages.
  • Method Details

    • withoutMetadata

      @CheckReturnValue public Messages.MessageChainBuilder withoutMetadata()
      Do not copy any metadata from the initial message to the chained message.
      Returns:
      the current Messages.MessageChainBuilder
    • withMetadata

      @CheckReturnValue public Messages.MessageChainBuilder withMetadata(Class<?>... mc)
      Copy the given metadata of the given classes from the initial message to the chained message, if the initial message does not include a metadata object of the given class. In general, this method must be used after withoutMetadata().
      Returns:
      the current Messages.MessageChainBuilder
    • withoutMetadata

      @CheckReturnValue public Messages.MessageChainBuilder withoutMetadata(Class<?>... mc)
      Do not the given metadata of the given classes from the initial message to the chained message, if the initial message does not include a metadata object of the given class.
      Returns:
      the current Messages.MessageChainBuilder
    • with

      public List<Message<?>> with(Message<?>... messages)
      Chain the passed array of messages. The messages are not modified, but should not be used afterward, and should be replaced by the messages contained in the returned list. This method preserve the order. So, the first message corresponds to the first message in the returned list. The message from the returned list have the necessary logic to chain the ack/nack signals and the copied metadata.
      Parameters:
      messages - the chained messages, must not be empty, must not be null, must not contain null
      Returns:
      the list of modified messages
    • with

      public TargetedMessages with(Map<String,Message<?>> messages)
      Chain the passed map of messages. The messages are not modified, but should not be used afterward, and should be replaced by the messages contained in the returned TargetedMessages. Returned TargetedMessages keeps the same channel keys as the passed map. Messages from the returned TargetedMessages have the necessary logic to chain the ack/nack signals and the copied metadata.
      Parameters:
      messages - the map of channel name to message
      Returns:
      the TargetedMessages containing modified messages with chained acknowledgement to the input