Annotation Interface Acknowledgment


@Retention(RUNTIME) public @interface Acknowledgment
Configure the acknowledgement policy for the given @Incoming. Reactive Messaging proposes four acknowledgement strategies:
  • MANUAL: the acknowledgement (positive or negative) is up to the user. This is the default strategy for methods ingesting or producing Message.
  • POST_PROCESSING: acknowledges the incoming message once the produced message is acknowledged. This is the default strategy for methods ingesting or producing single payloads.
  • PRE_PROCESSING: acknowledges the incoming messages before calling the method.
  • NONE: do not apply any acknowledgement.
The set of supported acknowledgment policies depends on the method signature. The following list gives the supported strategies for some common use cases.
  • @Incoming("channel") void method(I payload): Post-processing (default), Pre-processing, None
  • @Incoming("channel") CompletionStage<?> method(I payload): Post-processing (default), Pre-processing, None
  • @Incoming("in") @Outgoing("out") Message<O> method(Message<I> msg): , Manual (default), Pre-processing, None
  • @Incoming("in") @Outgoing("out") O method(I payload): Post-Processing (default), Pre-processing, None
Note that all messages must be acknowledged. An absence of acknowledgment is considered as a failure. The following table lists the supported strategies (and the default) for each supported signature:
Signature Default Acknowledgement Strategy Supported Strategies
 @Incoming("channel")
 Subscriber<Message<I>> method()
 

Manual

None, Pre-Processing, Post-Processing (when the onNext method returns), Manual

 @Incoming("channel")
 Subscriber<I> method()
 

Post-Processing

None, Pre-Processing, Post-Processing (when the onNext method returns)

 @Incoming("channel")
 SubscriberBuilder<Message<I>, Void> method()
 

Manual

None, Pre-Processing, Post-Processing (when the onNext method returns), Manual

 @Incoming("channel")
 SubscriberBuilder<I, Void> method()
 

Post-Processing

None, Pre-Processing, Post-Processing (when the onNext method returns)

 @Incoming("channel")
 void method(I payload)
 

Post-Processing

None, Pre-Processing, Post-Processing (when the method returns)

 @Incoming("channel")
 CompletionStage<?> method(Message<I> msg)
 

Manual

None, Pre-Processing, Post-Processing (when the returned CompletionStage is completed), Manual

 @Incoming("channel")
 CompletionStage<?> method(I payload)
 

Post-Processing

None, Pre-Processing, Post-Processing (when the returned CompletionStage is completed)

 @Incoming("in")
 @Outgoing("out")
 Processor<Message<I>, Message<O>> method()
 

Manual

None, Pre-Processing, Manual

 @Incoming("in")
 @Outgoing("out")
 Processor<I, O> method();
 

Pre-Processing

None, Pre-Processing Post-Processing can be optionally supported by implementations, however it requires a 1:1 mapping between the incoming element and the outgoing element.

 @Incoming("in")
 @Outgoing("out")
 ProcessorBuilder<Message<I>, Message<O>> method();
 

Manual

None, Pre-Processing, Manual

 @Incoming("in")
 @Outgoing("out")
 ProcessorBuilder<I, O> method();
 

Pre-Processing

None, Pre-Processing Post-Processing can be optionally supported by implementations, however it requires a 1:1 mapping the incoming element and the outgoing element.

 @Incoming("in")
 @Outgoing("out")
 Publisher<Message<O>> method(Message<I> msg)
 

Manual

None, Manual, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 Publisher<O> method(I payload)
 

Pre-Processing

None, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 PublisherBuilder<Message<O>> method(Message<I> msg)
 

Manual

None, Manual, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 PublisherBuilder<O> method(I payload)
 

Pre-Processing

None, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 Message<O> method(Message<I> msg)
 

Manual

None, Manual, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 O method(I payload)
 

Post-Processing

None, Pre-Processing, Post-Processing (when the message wrapping the produced payload is acknowledged)

 @Incoming("in")
 @Outgoing("out")
 CompletionStage<Message<O>> method(Message<I> msg)
 

Manual

None, Manual, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 CompletionStage<O> method(I payload)
 

Post-Processing

None, Pre-Processing, Post-Processing (when the message wrapping the produced payload is acknowledged)

 @Incoming("in")
 @Outgoing("out")
 Publisher<Message<O>> method(Publisher<Message<I>> pub)
 

Manual

None, Manual, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 PublisherBuilder<Message<O>> method(PublisherBuilder<Message<I>> pub)
 

Manual

None, Manual, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 Publisher<O> method(Publisher<I> pub)
 

Pre-Processing

None, Pre-Processing

 @Incoming("in")
 @Outgoing("out")
 PublisherBuilder<O> method(PublisherBuilder<I> pub)
 

Pre-Processing

None, Pre-Processing