Package de.otto.synapse.endpoint.sender
Class DelegateMessageSenderEndpoint
- java.lang.Object
-
- de.otto.synapse.endpoint.sender.DelegateMessageSenderEndpoint
-
- All Implemented Interfaces:
MessageEndpoint,MessageSender,MessageSenderEndpoint
public class DelegateMessageSenderEndpoint extends java.lang.Object implements MessageSenderEndpoint
-
-
Constructor Summary
Constructors Constructor Description DelegateMessageSenderEndpoint(java.lang.String channelName, java.lang.Class<? extends Selector> selector, MessageFormat messageFormat, java.util.List<MessageSenderEndpointFactory> factories)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetChannelName()Returns the name of the channel.EndpointTypegetEndpointType()InterceptorChaingetInterceptorChain()Returns theInterceptorChainof theMessageEndpoint.MessageFormatgetMessageFormat()TextMessageintercept(TextMessage message)Intercepts a message using all registered interceptors and returns the resulting message.java.util.concurrent.CompletableFuture<java.lang.Void>send(Message<?> message)Send a singleMessageto the channel.java.util.concurrent.CompletableFuture<java.lang.Void>sendBatch(java.util.stream.Stream<? extends Message<?>> batch)Send a batch ofmessagesto the channel.
-
-
-
Constructor Detail
-
DelegateMessageSenderEndpoint
public DelegateMessageSenderEndpoint(@Nonnull java.lang.String channelName, @Nonnull java.lang.Class<? extends Selector> selector, @Nonnull MessageFormat messageFormat, java.util.List<MessageSenderEndpointFactory> factories)
-
-
Method Detail
-
getChannelName
@Nonnull public java.lang.String getChannelName()
Description copied from interface:MessageEndpointReturns the name of the channel.The channel name corresponds to the name of the underlying stream, queue or message log.
- Specified by:
getChannelNamein interfaceMessageEndpoint- Returns:
- name of the channel
-
getMessageFormat
@Nonnull public MessageFormat getMessageFormat()
-
getInterceptorChain
@Nonnull public InterceptorChain getInterceptorChain()
Description copied from interface:MessageEndpointReturns theInterceptorChainof theMessageEndpoint.- Specified by:
getInterceptorChainin interfaceMessageEndpoint- Returns:
- InterceptorChain
-
getEndpointType
@Nonnull public EndpointType getEndpointType()
Description copied from interface:MessageEndpoint- Specified by:
getEndpointTypein interfaceMessageEndpoint- Returns:
- EndpointType
-
intercept
@Nullable public TextMessage intercept(@Nonnull TextMessage message)
Description copied from interface:MessageEndpointIntercepts a message using all registered interceptors and returns the resulting message.The 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
nullis returned, the message must be dropped by theAbstractMessageEndpoint.Every interceptor may transform the message, or may take additional actions like, for example, logging, monitoring or other things.
- Specified by:
interceptin interfaceMessageEndpoint- Parameters:
message- the message to intercept- Returns:
- the (possibly modified) message, or null if the message should be dropped.
-
send
public java.util.concurrent.CompletableFuture<java.lang.Void> send(@Nonnull Message<?> message)Description copied from interface:MessageSenderSend a singleMessageto the channel.- Specified by:
sendin interfaceMessageSender- Parameters:
message- the message- Returns:
- a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.
-
sendBatch
public java.util.concurrent.CompletableFuture<java.lang.Void> sendBatch(@Nonnull java.util.stream.Stream<? extends Message<?>> batch)Description copied from interface:MessageSenderSend a batch ofmessagesto the channel.- Specified by:
sendBatchin interfaceMessageSender- Parameters:
batch- the batch of messages- Returns:
- a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.
-
-