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-side
MessageEndpoint endpoint of a Message Channel with support for message translation.
and interception.
- See Also:
- EIP: Message Endpoint, EIP: Message Channel
-
Field Summary
Fields Modifier and Type Field Description static intBATCH_SENDER_TIMEOUT -
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()java.util.concurrent.CompletableFuture<java.lang.Void>send(Message<?> message)Sends aMessageto the message channel.java.util.concurrent.CompletableFuture<java.lang.Void>sendBatch(java.util.stream.Stream<? extends Message<?>> 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, interceptMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.otto.synapse.endpoint.MessageEndpoint
getChannelName, getInterceptorChain, intercept
-
Field Details
-
BATCH_SENDER_TIMEOUT
public static final int BATCH_SENDER_TIMEOUT- See Also:
- Constant Field Values
-
-
Constructor Details
-
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 Details
-
send
public final java.util.concurrent.CompletableFuture<java.lang.Void> send(@Nonnull Message<?> message)Sends aMessageto the message channel.- Specified by:
sendin interfaceMessageSender- Parameters:
message- the message to send- Returns:
- a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.
-
sendBatch
public final java.util.concurrent.CompletableFuture<java.lang.Void> sendBatch(@Nonnull java.util.stream.Stream<? extends Message<?>> 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- 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
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
-