Interface Consumer.Context
- All Known Subinterfaces:
Consumer.BatchContext
- Enclosing interface:
Consumer
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept()Accept the message (AMQP 1.0acceptedoutcome).batch(int batchSizeHint) Create a batch context to accumulate message contexts and settle them at once.voiddelayedRetry(Duration delay) Requeue the message for redelivery after the specified delay.voiddelayedRetry(Duration delay, boolean deliveryFailed) Requeue the message for redelivery after the specified delay.voiddelayedRetry(Instant deliveryTime) Requeue the message for redelivery at the specified time.voiddelayedRetry(Instant deliveryTime, boolean deliveryFailed) Requeue the message for redelivery at the specified time.voiddiscard()Discard the message (AMQP 1.0rejectedoutcome).voidDiscard the message with annotations to combine with the existing message annotations.voidrequeue()Requeue the message (AMQP 1.0releasedoutcome).voidRequeue the message with annotations to combine with the existing message annotations.voidRequeue the message with annotations to combine with the existing message annotations.
-
Method Details
-
accept
void accept()Accept the message (AMQP 1.0acceptedoutcome).This means the message has been processed and the broker can delete it.
-
discard
void discard()Discard the message (AMQP 1.0rejectedoutcome).This means the message cannot be processed because it is invalid, the broker can drop it or dead-letter it if it is configured.
-
discard
Discard the message with annotations to combine with the existing message annotations.This means the message cannot be processed because it is invalid, the broker can drop it or dead-letter it if it is configured.
Custom application-specific annotation keys should start with the
x-opt-prefix so they are safely ignored if not understood. Keys starting withx-(but notx-opt-) are reserved for broker-specific features, and unrecognized keys will cause a protocol error.This maps to the AMQP 1.0
modified{delivery-failed = true, undeliverable-here = true}outcome.Only quorum queues support the modification of message annotations with the
modifiedoutcome.- Parameters:
annotations- message annotations to combine with existing ones- See Also:
-
requeue
void requeue()Requeue the message (AMQP 1.0releasedoutcome).This means the message has not been processed and the broker can requeue it and deliver it to the same or a different consumer.
-
requeue
Requeue the message with annotations to combine with the existing message annotations.This means the message has not been processed and the broker can requeue it and deliver it to the same or a different consumer.
Custom application-specific annotation keys should start with the
x-opt-prefix so they are safely ignored if not understood. Keys starting withx-(but notx-opt-) are reserved for broker-specific features, and unrecognized keys will cause a protocol error.This maps to the AMQP 1.0
modified{delivery-failed = false, undeliverable-here = false}outcome.Only quorum queues support the modification of message annotations with the
modifiedoutcome.- Parameters:
annotations- message annotations to combine with existing ones- See Also:
-
requeue
Requeue the message with annotations to combine with the existing message annotations.This means the message has not been processed and the broker can requeue it and deliver it to the same or a different consumer.
Custom application-specific annotation keys should start with the
x-opt-prefix so they are safely ignored if not understood. Keys starting withx-(but notx-opt-) are reserved for broker-specific features, and unrecognized keys will cause a protocol error.This maps to the AMQP 1.0
modified{delivery-failed = deliveryFailed, undeliverable-here = false}outcome.Only quorum queues support the modification of message annotations with the
modifiedoutcome.- Parameters:
annotations- message annotations to combine with existing onesdeliveryFailed- if true, the delivery count of the message is incremented- See Also:
-
delayedRetry
Requeue the message for redelivery after the specified delay.This maps to the AMQP 1.0
modified{delivery-failed = false, undeliverable-here = false}outcome with thex-opt-delivery-timeannotation set tonow + delay.Only quorum queues support the modification of message annotations with the
modifiedoutcome.- Parameters:
delay- delivery delay from now- See Also:
-
delayedRetry
Requeue the message for redelivery after the specified delay.This maps to the AMQP 1.0
modified{delivery-failed = false, undeliverable-here = false}outcome with thex-opt-delivery-timeannotation set tonow + delay.Only quorum queues support the modification of message annotations with the
modifiedoutcome.- Parameters:
delay- delivery delay from nowdeliveryFailed- if true, the delivery count of the message is incremented- See Also:
-
delayedRetry
Requeue the message for redelivery at the specified time.This maps to the AMQP 1.0
modified{delivery-failed = false, undeliverable-here = false}outcome with thex-opt-delivery-timeannotation set to the specified time.Only quorum queues support the modification of message annotations with the
modifiedoutcome.- Parameters:
deliveryTime- absolute delivery time- See Also:
-
delayedRetry
Requeue the message for redelivery at the specified time.This maps to the AMQP 1.0
modified{delivery-failed = false, undeliverable-here = false}outcome with thex-opt-delivery-timeannotation set to the specified time.Only quorum queues support the modification of message annotations with the
modifiedoutcome.- Parameters:
deliveryTime- absolute delivery timedeliveryFailed- if true, the delivery count of the message is incremented- See Also:
-
batch
Create a batch context to accumulate message contexts and settle them at once.The message context the batch context is created from is not added to the batch context.
- Returns:
- the created batch context
-