public class InMemoryChannel extends MessageLogReceiverEndpoint
| Constructor and Description |
|---|
InMemoryChannel(java.lang.String channelName) |
InMemoryChannel(java.lang.String channelName,
com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
| Modifier and Type | Method and Description |
|---|---|
ChannelPosition |
consume(ChannelPosition startFrom,
java.util.function.Predicate<Message<?>> stopCondition)
Takes zero or more messages from the channel, calls
MessageEndpoint.intercept(Message) for every message, and notifies
the registered consumers with the intercepted message, or drops the message, if intercept returns null. |
void |
send(Message<java.lang.String> event) |
void |
stop() |
getMessageDispatcher, registergetChannelName, intercept, registerpublic InMemoryChannel(java.lang.String channelName)
public InMemoryChannel(java.lang.String channelName,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public void send(Message<java.lang.String> event)
@Nonnull public ChannelPosition consume(@Nonnull ChannelPosition startFrom, @Nonnull java.util.function.Predicate<Message<?>> stopCondition)
MessageLogReceiverEndpointMessageEndpoint.intercept(Message) for every message, and notifies
the registered consumers with the intercepted message, or drops the message, if intercept returns null.
Consumption starts with the first message after startFrom and finishes when either the
stopCondition is met, or the application is shutting down.
The returned ChannelPosition is the position of the last message that was processed by the
MessageLogReceiverEndpoint - whether it was dropped or consumed.
The registered consumers are used as a
callback for consumed messages. A MessageDispatcher can be used as a consumer, if multiple
consumers, or consumers with message payloads other than String are
required.
consume in class MessageLogReceiverEndpointstartFrom - the start position used to proceed message consumptionstopCondition - the predicate used to check if consumption should stop.public void stop()
stop in class MessageLogReceiverEndpoint