public class DelegateMessageSenderEndpoint extends java.lang.Object implements MessageSenderEndpoint
| Constructor and Description |
|---|
DelegateMessageSenderEndpoint(java.lang.String channelName,
java.util.List<MessageSenderEndpointFactory> factories) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getChannelName()
Returns the name of the channel.
|
EndpointType |
getEndpointType()
|
InterceptorChain |
getInterceptorChain()
Returns the
InterceptorChain of the MessageEndpoint. |
Message<java.lang.String> |
intercept(Message<java.lang.String> message)
Intercepts a message using all registered interceptors and returns the resulting message.
|
void |
registerInterceptorsFrom(MessageInterceptorRegistry registry)
Registers all
MessageInterceptor from the registry that is matching
the channel name and endpoint type. |
<T> java.util.concurrent.CompletableFuture<java.lang.Void> |
send(Message<T> message)
Send a single
Message to the channel. |
<T> java.util.concurrent.CompletableFuture<java.lang.Void> |
sendBatch(java.util.stream.Stream<Message<T>> batch)
Send a batch of
messages to the channel. |
public DelegateMessageSenderEndpoint(@Nonnull
java.lang.String channelName,
java.util.List<MessageSenderEndpointFactory> factories)
@Nonnull public java.lang.String getChannelName()
MessageEndpointThe channel name corresponds to the name of the underlying stream, queue or message log.
getChannelName in interface MessageEndpoint@Nonnull public InterceptorChain getInterceptorChain()
MessageEndpointInterceptorChain of the MessageEndpoint.getInterceptorChain in interface MessageEndpointpublic void registerInterceptorsFrom(@Nonnull
MessageInterceptorRegistry registry)
MessageEndpointMessageInterceptor from the registry that is matching
the channel name and endpoint type.
The registered interceptors will be used to intercept messages processed by the endpoint.
registerInterceptorsFrom in interface MessageEndpointregistry - the MessageInterceptorRegistry@Nonnull public EndpointType getEndpointType()
MessageEndpointgetEndpointType in interface MessageEndpoint@Nullable public Message<java.lang.String> intercept(@Nonnull Message<java.lang.String> message)
MessageEndpointThe interceptors are called in order. The result of one interceptor is propagated to the next interceptor in the chain, until the end of the chain is reached, or one interceptor has returned null.
If null is returned, the message must be dropped by the AbstractMessageEndpoint.
Every interceptor may transform the message, or may take additional actions like, for example, logging, monitoring or other things.
intercept in interface MessageEndpointmessage - the message to interceptpublic <T> java.util.concurrent.CompletableFuture<java.lang.Void> send(@Nonnull
Message<T> message)
MessageSenderEndpointMessage to the channel.send in interface MessageSenderEndpointT - the type of the message payloadmessage - the messagepublic <T> java.util.concurrent.CompletableFuture<java.lang.Void> sendBatch(@Nonnull
java.util.stream.Stream<Message<T>> batch)
MessageSenderEndpointmessages to the channel.sendBatch in interface MessageSenderEndpointT - the type of the message payloadbatch - the batch of messages