Package io.atleon.rabbitmq
Class AloRabbitMQReceiver<T>
- java.lang.Object
-
- io.atleon.rabbitmq.AloRabbitMQReceiver<T>
-
- Type Parameters:
T- Inbound message deserialized body type
public class AloRabbitMQReceiver<T> extends Object
A reactive RabbitMQ receiver with at-least-once semantics for consuming messages from a queue in a RabbitMQ cluster.Note that
AloDecoratorsapplied viaAloDecoratorConfig.DECORATOR_TYPES_CONFIGmust be implementations ofAloReceivedRabbitMQMessageDecorator.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAloRabbitMQReceiver.NackStrategyDeprecated.
-
Field Summary
Fields Modifier and Type Field Description static StringBODY_DESERIALIZER_CONFIGAn implementation ofBodyDeserializerused to deserialized message bodiesstatic StringCONFIG_PREFIXPrefix used on all AloRabbitMQReceiver-specific configurationsstatic StringERROR_EMISSION_TIMEOUT_CONFIGWhen negative acknowledgement results in emitting the corresponding error, this configures the timeout on successfully emitting that error.static StringNACK_STRATEGY_CONFIGDeprecated.static StringNACKNOWLEDGER_TYPE_CONFIGConfigures the behavior of negatively acknowledging SQS Messages.static StringNACKNOWLEDGER_TYPE_DISCARDstatic StringNACKNOWLEDGER_TYPE_EMITstatic StringNACKNOWLEDGER_TYPE_REQUEUEstatic StringQOS_CONFIGThe maximum allowed number unacknowledged messages (per subscription)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> AloRabbitMQReceiver<T>create(RabbitMQConfigSource configSource)Creates a new AloRabbitMQReceiver from the providedRabbitMQConfigSourcestatic <T> AloRabbitMQReceiver<T>from(RabbitMQConfigSource configSource)Alias forcreate(RabbitMQConfigSource).AloFlux<T>receiveAloBodies(String queue)AloFlux<ReceivedRabbitMQMessage<T>>receiveAloMessages(String queue)
-
-
-
Field Detail
-
CONFIG_PREFIX
public static final String CONFIG_PREFIX
Prefix used on all AloRabbitMQReceiver-specific configurations- See Also:
- Constant Field Values
-
QOS_CONFIG
public static final String QOS_CONFIG
The maximum allowed number unacknowledged messages (per subscription)- See Also:
- Constant Field Values
-
BODY_DESERIALIZER_CONFIG
public static final String BODY_DESERIALIZER_CONFIG
An implementation ofBodyDeserializerused to deserialized message bodies- See Also:
- Constant Field Values
-
NACK_STRATEGY_CONFIG
@Deprecated public static final String NACK_STRATEGY_CONFIG
Deprecated.- See Also:
- Constant Field Values
-
NACKNOWLEDGER_TYPE_CONFIG
public static final String NACKNOWLEDGER_TYPE_CONFIG
Configures the behavior of negatively acknowledging SQS Messages. Several simple types are available including "emit", where the associated error is emitted in to the pipeline, "requeue" which re-queues the associated message such that it is re-received in the future, and "discard" which causes the message to be dropped or routed to a dead-letter queue, if configured. Any other non-predefined value is treated as a qualified class name of an implementation ofNacknowledgerFactorywhich allows more fine-grained control over what happens when a RabbitMQ Message is negatively acknowledged. Defaults to "emit".- See Also:
- Constant Field Values
-
NACKNOWLEDGER_TYPE_EMIT
public static final String NACKNOWLEDGER_TYPE_EMIT
- See Also:
- Constant Field Values
-
NACKNOWLEDGER_TYPE_REQUEUE
public static final String NACKNOWLEDGER_TYPE_REQUEUE
- See Also:
- Constant Field Values
-
NACKNOWLEDGER_TYPE_DISCARD
public static final String NACKNOWLEDGER_TYPE_DISCARD
- See Also:
- Constant Field Values
-
ERROR_EMISSION_TIMEOUT_CONFIG
public static final String ERROR_EMISSION_TIMEOUT_CONFIG
When negative acknowledgement results in emitting the corresponding error, this configures the timeout on successfully emitting that error.- See Also:
- Constant Field Values
-
-
Method Detail
-
from
public static <T> AloRabbitMQReceiver<T> from(RabbitMQConfigSource configSource)
Alias forcreate(RabbitMQConfigSource). Will be deprecated in future release.
-
create
public static <T> AloRabbitMQReceiver<T> create(RabbitMQConfigSource configSource)
Creates a new AloRabbitMQReceiver from the providedRabbitMQConfigSource- Type Parameters:
T- The types of deserialized message bodies contained in received messages- Parameters:
configSource- The reactive source ofRabbitMQConfig- Returns:
- A new AloRabbitMQReceiver
-
receiveAloBodies
public AloFlux<T> receiveAloBodies(String queue)
Creates a Publisher ofAloitems referencing deserialized RabbitMQ message bodies wrapped as anAloFlux.- Parameters:
queue- The queue to subscribe to- Returns:
- A Publisher of Alo items referencing deserialized RabbitMQ message bodies
-
receiveAloMessages
public AloFlux<ReceivedRabbitMQMessage<T>> receiveAloMessages(String queue)
- Parameters:
queue- The queue to subscribe to- Returns:
- A Publisher of Alo items referencing ReceivedRabbitMQMessages
-
-