de.otto.synapse.endpoint.sender.MessageSender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of synapse-core Show documentation
Show all versions of synapse-core Show documentation
A library used at otto.de to implement Spring Boot based event-sourcing microservices.
package de.otto.synapse.endpoint.sender;
import de.otto.synapse.message.Message;
import jakarta.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;
/**
* Endpoint that is used by an application to send messages to a messaging channel.
*
*
*
*
*
* @see EIP: Message Endpoint
*/
public interface MessageSender {
/**
* Send a single {@link Message} to the channel.
*
* @param message the message
* @return a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.
*/
CompletableFuture send(@Nonnull Message> message);
/**
* Send a batch of {@link Message messages} to the channel.
*
* @param batch the batch of messages
* @return a CompletableFuture that can be used for logging, error handling, waiting for completion, etc.
*/
CompletableFuture sendBatch(@Nonnull Stream extends Message>> batch);
}