Class DefaultDurableQueueConsumer<DURABLE_QUEUES extends DurableQueues,UOW extends UnitOfWork,UOW_FACTORY extends UnitOfWorkFactory<UOW>>
java.lang.Object
dk.cloudcreate.essentials.components.foundation.messaging.queue.DefaultDurableQueueConsumer<DURABLE_QUEUES,UOW,UOW_FACTORY>
- Type Parameters:
DURABLE_QUEUES- the concrete type ofDurableQueuesimplementationUOW- theUnitOfWorktypeUOW_FACTORY- theUnitOfWorkFactorytype
- All Implemented Interfaces:
Lifecycle,DurableQueueConsumer,DurableQueueConsumerNotifications,dk.cloudcreate.essentials.shared.Lifecycle
public abstract class DefaultDurableQueueConsumer<DURABLE_QUEUES extends DurableQueues,UOW extends UnitOfWork,UOW_FACTORY extends UnitOfWorkFactory<UOW>>
extends Object
implements DurableQueueConsumer, DurableQueueConsumerNotifications
The default
Log levels of interest:
DurableQueueConsumer which provides basic implementation (including retrying messages
in case of failure, polling interval optimization, etc.)Log levels of interest:
dk.cloudcreate.essentials.components.foundation.messaging.queue.DurableQueueConsumer
dk.cloudcreate.essentials.components.foundation.messaging.queue.DurableQueueConsumer.MessageHandlingFailures
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDurableQueueConsumer(ConsumeFromQueue consumeFromQueue, UOW_FACTORY unitOfWorkFactory, DURABLE_QUEUES durableQueues, Consumer<DurableQueueConsumer> removeDurableQueueConsumer, long pollingIntervalMs, QueuePollingOptimizer queuePollingOptimizer) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()protected booleanisPermanentError(QueuedMessage queuedMessage, Throwable e) booleanvoidmessageAdded(QueuedMessage queuedMessage) Notification from theDurableQueuesimplementation that a new message has been added to the Queue that the givenDurableQueueConsumeris consuming messages from
Note: A consumer still needs to useDurableQueues.getNextMessageReadyForDelivery(GetNextMessageReadyForDelivery)to ensure proper message locking of messages that they are processingvoidstart()voidstop()toString()
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
MESSAGE_HANDLING_FAILURE_LOG
public static final org.slf4j.Logger MESSAGE_HANDLING_FAILURE_LOG -
NO_POSTPROCESSING_AFTER_PROCESS_NEXT_MESSAGE
-
queueName
-
-
Constructor Details
-
DefaultDurableQueueConsumer
public DefaultDurableQueueConsumer(ConsumeFromQueue consumeFromQueue, UOW_FACTORY unitOfWorkFactory, DURABLE_QUEUES durableQueues, Consumer<DurableQueueConsumer> removeDurableQueueConsumer, long pollingIntervalMs, QueuePollingOptimizer queuePollingOptimizer)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfacedk.cloudcreate.essentials.shared.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfacedk.cloudcreate.essentials.shared.Lifecycle
-
isStarted
public boolean isStarted()- Specified by:
isStartedin interfacedk.cloudcreate.essentials.shared.Lifecycle
-
queueName
- Specified by:
queueNamein interfaceDurableQueueConsumer
-
consumerName
- Specified by:
consumerNamein interfaceDurableQueueConsumer
-
cancel
public void cancel()- Specified by:
cancelin interfaceDurableQueueConsumer
-
isPermanentError
-
messageAdded
Description copied from interface:DurableQueueConsumerNotificationsNotification from theDurableQueuesimplementation that a new message has been added to the Queue that the givenDurableQueueConsumeris consuming messages from
Note: A consumer still needs to useDurableQueues.getNextMessageReadyForDelivery(GetNextMessageReadyForDelivery)to ensure proper message locking of messages that they are processing- Specified by:
messageAddedin interfaceDurableQueueConsumerNotifications- Parameters:
queuedMessage- the message added
-
toString
-