Package io.smallrye.reactive.messaging
Class Messages.MessageChainBuilder
java.lang.Object
io.smallrye.reactive.messaging.Messages.MessageChainBuilder
- Enclosing interface:
- Messages
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 Summary
Modifier and TypeMethodDescriptionChain the passed map of messages.Chain the passed array of messages.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.Do not copy any metadata from the initial message to the chained message.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.
-
Method Details
-
withoutMetadata
Do not copy any metadata from the initial message to the chained message.- Returns:
- the current
Messages.MessageChainBuilder
-
withMetadata
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 afterwithoutMetadata()
.- Returns:
- the current
Messages.MessageChainBuilder
-
withoutMetadata
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
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
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 returnedTargetedMessages
. ReturnedTargetedMessages
keeps the same channel keys as the passed map. Messages from the returnedTargetedMessages
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
-