Class DelegateMessageSenderEndpoint

    • 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: MessageEndpoint
        Returns the name of the channel.

        The channel name corresponds to the name of the underlying stream, queue or message log.

        Specified by:
        getChannelName in interface MessageEndpoint
        Returns:
        name of the channel
      • getMessageFormat

        @Nonnull
        public MessageFormat getMessageFormat()
      • intercept

        @Nullable
        public TextMessage intercept​(@Nonnull
                                     TextMessage message)
        Description copied from interface: MessageEndpoint
        Intercepts 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 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.

        Specified by:
        intercept in interface MessageEndpoint
        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: MessageSender
        Send a single Message to the channel.
        Specified by:
        send in interface MessageSender
        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: MessageSender
        Send a batch of messages to the channel.
        Specified by:
        sendBatch in interface MessageSender
        Parameters:
        batch - the batch of messages
        Returns:
        a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.