Message
- The message type.
Note: This class is not meant to be extended by client code.public interface Subscriber<Message>
Modifier and Type | Interface and Description |
---|---|
static interface |
Subscriber.GroupId
Subscribers with the same group id belong to the same subscriber group.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletionStage<akka.Done> |
atLeastOnce(akka.stream.javadsl.Flow<Message,akka.Done,?> flow)
Applies the passed
flow to the messages processed by this
subscriber. |
akka.stream.javadsl.Source<Message,?> |
atMostOnceSource()
Returns a stream of messages with at most once delivery semantic.
|
Subscriber<Message> |
withGroupId(String groupId)
Returns a copy of this subscriber with the passed group id.
|
Subscriber<Message> withGroupId(String groupId) throws IllegalArgumentException
groupId
- The group id to assign to this subscriber.IllegalArgumentException
- If the passed group id is illegal.akka.stream.javadsl.Source<Message,?> atMostOnceSource()
java.util.concurrent.CompletionStage<akka.Done> atLeastOnce(akka.stream.javadsl.Flow<Message,akka.Done,?> flow)
flow
to the messages processed by this
subscriber. Messages are delivered to the passed flow
at least
once.
If a failure occurs (e.g., an exception is thrown), the stream may be
automatically restarted starting with the message that caused the failure.
Whether the stream is automatically restarted depends on the Lagom message
broker implementation in use. If the Kafka Lagom message broker module is
being used, then by default the stream is automatically restarted when a
failure occurs.flow
- The flow to apply to each received message.CompletionStage
that may never complete if messages
go through the passed flow
flawlessly. However, the
returned CompletionStage
may complete with success if
the passed flow
signals cancellation upstream.
If the returned CompletionStage
is completed with a
failure, user-code is responsible of deciding what to do (e.g., it
could retry to process the message that caused the failure, or it
could report an application error).