Payload- The message type.
Note: This class is not meant to be extended by client code.
public interface Subscriber<Payload>
|Modifier and Type||Interface and Description|
Subscribers with the same group id belong to the same subscriber group.
|Modifier and Type||Method and Description|
Applies the passed
Returns a stream of messages with at most once delivery semantic.
Returns a copy of this subscriber with the passed group id.
Returns this subscriber, but message payloads are wrapped in
Subscriber<Payload> withGroupId(String groupId) throws IllegalArgumentException
groupId- The group id to assign to this subscriber.
IllegalArgumentException- If the passed group id is illegal.
default Subscriber<Message<Payload>> withMetadata()
Messageinstances to allow accessing any metadata associated with the message.
If a failure occurs (e.g., an exception is thrown), the user is responsible of deciding how to recover from it (e.g., restarting the stream, aborting, ...).
CompletionStage<akka.Done> atLeastOnce(akka.stream.javadsl.Flow<Payload,akka.Done,?> flow)
flowto the messages processed by this subscriber. Messages are delivered to the passed
flowat 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 may pull more elements from upstream but it must emit exactly one
Done message for each message that it receives. It must also emit them in the same
order that the messages were received. This means that the
flow must not filter or
collect a subset of the messages, instead it must split the messages into separate streams and
map those that would have been dropped to
flow- The flow to apply to each received message.
CompletionStagethat may never complete if messages go through the passed
flowflawlessly. However, the returned
CompletionStagemay complete with success if the passed
flowsignals 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).