public interface MessageStore
When using a Message Store, we can take advantage of the asynchronous nature of a messaging infrastructure. When we send a message to a channel, we send a duplicate of the message to a special channel to be collected by the Message Store.
This can be performed by the component itself or we can insert a Wire Tap into the channel. We can consider the secondary channel that carries a copy of the message as part of the Control Bus. Sending a second message in a 'fire-and-forget' mode will not slow down the flow of the main application messages. It does, however, increase network traffic. That's why we may not store the complete message, but just a few key fields that are required for later analysis, such as a message ID, or the channel on which the message was sent and a timestamp.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Message<java.lang.String> message) |
ChannelPosition |
getLatestChannelPosition()
Returns the latest
ChannelPosition of the MessageStore. |
int |
size()
Returns the number of messages contained in the MessageStore.
|
java.util.stream.Stream<Message<java.lang.String>> |
stream()
Returns a Stream of
messages contained in the MessageStore. |
void add(Message<java.lang.String> message)
ChannelPosition getLatestChannelPosition()
ChannelPosition of the MessageStore.
The position is calculated by merging the
optional positions of the messages.
Messages without positions will not change the latest ChannelPosition. If no message contains
position information, the returned ChannelPosition is ChannelPosition.fromHorizon()
java.util.stream.Stream<Message<java.lang.String>> stream()
messages contained in the MessageStore.
The stream will maintain the insertion order of the messages.
int size()