Interface Consumer.Effect.Builder
- Enclosing interface:
Consumer.Effect
-
Method Summary
Modifier and TypeMethodDescriptionasyncDone
(CompletionStage<akka.Done> message) Mark the message as processed from an async operation result.asyncEffect
(CompletionStage<Consumer.Effect> futureEffect) Create an effect from an async operation that returns an effect.<S> Consumer.Effect
asyncProduce
(CompletionStage<S> message) Produce a message from an async operation result.<S> Consumer.Effect
asyncProduce
(CompletionStage<S> message, Metadata metadata) Produce a message from an async operation result with custom metadata.done()
Mark the message as successfully processed.ignore()
Ignore the current message and proceed with processing the next message.<S> Consumer.Effect
produce
(S message) Produce a message to a topic or service stream.<S> Consumer.Effect
Produce a message with custom metadata to a topic or service stream.
-
Method Details
-
done
Consumer.Effect done()Mark the message as successfully processed.Use this when the message has been processed and no further action is needed.
- Returns:
- an Effect indicating successful message processing
-
asyncDone
Mark the message as processed from an async operation result.Use this when message processing involves asynchronous operations that complete with a Done result.
- Parameters:
message
- the future result of the async operation- Returns:
- an Effect that will complete when the async operation completes
-
produce
Produce a message to a topic or service stream.This is used when the Consumer is also configured as a producer with
@Produce.ToTopic
or@Produce.ServiceStream
annotations. The message will be published using CloudEvents format.- Type Parameters:
S
- the type of the message- Parameters:
message
- the payload of the message to produce- Returns:
- an Effect that will produce the message
-
produce
Produce a message with custom metadata to a topic or service stream.Use this when you need to include additional metadata with the produced message, such as CloudEvent attributes or custom headers. To guarantee message ordering, include the entity id as the subject in the metadata.
- Type Parameters:
S
- the type of the message- Parameters:
message
- the payload of the message to producemetadata
- the metadata to include with the message- Returns:
- an Effect that will produce the message with the specified metadata
-
asyncProduce
Produce a message from an async operation result.Use this when the message to be produced is the result of an asynchronous operation.
- Type Parameters:
S
- the type of the message- Parameters:
message
- the future payload of the message to produce- Returns:
- an Effect that will produce the message when the async operation completes
-
asyncProduce
Produce a message from an async operation result with custom metadata.Combines async message production with custom metadata.
- Type Parameters:
S
- the type of the message- Parameters:
message
- the future payload of the message to producemetadata
- the metadata to include with the message- Returns:
- an Effect that will produce the message with metadata when the async operation completes
-
asyncEffect
Create an effect from an async operation that returns an effect.Use this when the effect to be applied depends on the result of an asynchronous operation.
- Parameters:
futureEffect
- the future effect to apply- Returns:
- an Effect that will apply the future effect when it completes
-
ignore
Consumer.Effect ignore()Ignore the current message and proceed with processing the next message.Use this to filter out messages that should not be processed, such as events that are not relevant to the Consumer's logic. The message will be acknowledged but no further processing occurs.
- Returns:
- an Effect that ignores the current message
-