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
public 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()booleanReturns true if the process is startedvoidmessageAdded(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()Start the processing.voidstop()Stop the processing.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()Description copied from interface:LifecycleStart the processing. This operation must be idempotent, such that duplicate calls toLifecycle.start()for an already started process (whereLifecycle.isStarted()returns true) is ignored -
stop
public void stop()Description copied from interface:LifecycleStop the processing. This operation must be idempotent, such that duplicate calls toLifecycle.stop()for an already stopped process (whereLifecycle.isStarted()returns false) is ignored -
isStarted
public boolean isStarted()Description copied from interface:LifecycleReturns true if the process is started -
queueName
- Specified by:
queueNamein interfaceDurableQueueConsumer
-
cancel
public void cancel()- Specified by:
cancelin interfaceDurableQueueConsumer
-
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
-