Package de.otto.synapse.endpoint.sender
Class AbstractMessageSenderEndpoint
- java.lang.Object
-
- de.otto.synapse.endpoint.AbstractMessageEndpoint
-
- de.otto.synapse.endpoint.sender.AbstractMessageSenderEndpoint
-
- All Implemented Interfaces:
MessageEndpoint,MessageSender,MessageSenderEndpoint
public abstract class AbstractMessageSenderEndpoint extends AbstractMessageEndpoint implements MessageSenderEndpoint
Sender-sideMessageEndpoint endpointof a Message Channel with support formessage translation. andinterception.
- See Also:
- EIP: Message Endpoint, EIP: Message Channel
-
-
Constructor Summary
Constructors Constructor Description AbstractMessageSenderEndpoint(java.lang.String channelName, MessageInterceptorRegistry interceptorRegistry, MessageTranslator<TextMessage> messageTranslator)Constructor used to create a new MessageEndpoint.
-
Method Summary
Modifier and Type Method Description protected abstract java.util.concurrent.CompletableFuture<java.lang.Void>doSend(TextMessage message)protected java.util.concurrent.CompletableFuture<java.lang.Void>doSendBatch(java.util.stream.Stream<TextMessage> batch)EndpointTypegetEndpointType()MessageFormatgetMessageFormat()<T> java.util.concurrent.CompletableFuture<java.lang.Void>send(Message<T> message)Sends aMessageto the message channel.<T> java.util.concurrent.CompletableFuture<java.lang.Void>sendBatch(java.util.stream.Stream<Message<T>> batch)Sends a stream of messages to the message channel as one or more batches, if batches are supported by the infrastructure.-
Methods inherited from class de.otto.synapse.endpoint.AbstractMessageEndpoint
getChannelName, getInterceptorChain, intercept
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.otto.synapse.endpoint.MessageEndpoint
getChannelName, getInterceptorChain, intercept
-
-
-
-
Constructor Detail
-
AbstractMessageSenderEndpoint
public AbstractMessageSenderEndpoint(@Nonnull java.lang.String channelName, @Nonnull MessageInterceptorRegistry interceptorRegistry, @Nonnull MessageTranslator<TextMessage> messageTranslator)Constructor used to create a new MessageEndpoint.- Parameters:
channelName- the name of the underlying channel / stream / queue / message log.interceptorRegistry- registry used to determinemessage interceptorsfor this endpoint.messageTranslator- the MessageTranslator used to translate message payloads as expected by theconsumers.
-
-
Method Detail
-
send
public final <T> java.util.concurrent.CompletableFuture<java.lang.Void> send(@Nonnull Message<T> message)Sends aMessageto the message channel.- Specified by:
sendin interfaceMessageSender- Type Parameters:
T- type of the message's payload- Parameters:
message- the message to send- Returns:
- a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.
-
sendBatch
public final <T> java.util.concurrent.CompletableFuture<java.lang.Void> sendBatch(@Nonnull java.util.stream.Stream<Message<T>> batch)Sends a stream of messages to the message channel as one or more batches, if batches are supported by the infrastructure. If not, the messages are send one by one.- Specified by:
sendBatchin interfaceMessageSender- Type Parameters:
T- the type of the message payload- Parameters:
batch- a stream of messages that is sent in batched mode, if supported- Returns:
- a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.
-
getEndpointType
@Nonnull public final EndpointType getEndpointType()
Description copied from interface:MessageEndpoint- Specified by:
getEndpointTypein interfaceMessageEndpoint- Returns:
- EndpointType
-
doSendBatch
protected java.util.concurrent.CompletableFuture<java.lang.Void> doSendBatch(@Nonnull java.util.stream.Stream<TextMessage> batch)
-
doSend
protected abstract java.util.concurrent.CompletableFuture<java.lang.Void> doSend(@Nonnull TextMessage message)
-
getMessageFormat
public MessageFormat getMessageFormat()
-
-