Class Inboxes.DurableQueueBasedInboxes.DurableQueueBasedInbox
java.lang.Object
dk.cloudcreate.essentials.components.foundation.messaging.eip.store_and_forward.Inboxes.DurableQueueBasedInboxes.DurableQueueBasedInbox
- All Implemented Interfaces:
Inbox
- Enclosing class:
- Inboxes.DurableQueueBasedInboxes
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDurableQueueBasedInbox(InboxConfig config) DurableQueueBasedInbox(InboxConfig config, Consumer<Message> messageConsumer) -
Method Summary
Modifier and TypeMethodDescriptionaddMessageReceived(Message message) Register or add a message that has been received
This message will be stored durably (without any duplication check) in connection with the currently activeUnitOfWork(or a newUnitOfWorkwill be created in case no there isn't an activeUnitOfWork).
The message will be delivered asynchronously to the message consumerStart consuming messages from the Inbox using the provided message consumer.
This is the same as callingInbox.setMessageConsumer(Consumer)followed byInbox.startConsuming()
Only needs to be called if the instance was created without a message consumer such as viaInboxes.getOrCreateInbox(InboxConfig)longGet the number of message received that haven't been processed yet (or successfully processed) by the message consumerbooleanHas the instance been created with a Message consumer or hasInbox.consume(Consumer)been calledbooleanIs the provided Message consumer consuming messages from theInboxname()The name of the inboxsetMessageConsumer(Consumer<Message> messageConsumer) Set the message consumer.Start consuming messages from theInbox.Stop consuming messages from theInbox.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dk.cloudcreate.essentials.components.foundation.messaging.eip.store_and_forward.Inbox
addMessageReceived, addMessageReceived
-
Field Details
-
inboxQueueName
-
config
-
-
Constructor Details
-
DurableQueueBasedInbox
-
DurableQueueBasedInbox
-
-
Method Details
-
consume
Description copied from interface:InboxStart consuming messages from the Inbox using the provided message consumer.
This is the same as callingInbox.setMessageConsumer(Consumer)followed byInbox.startConsuming()
Only needs to be called if the instance was created without a message consumer such as viaInboxes.getOrCreateInbox(InboxConfig)If an
OrderedMessageis delivered via anInboxusing aFencedLock(such asInboxes.durableQueueBasedInboxes(DurableQueues, FencedLockManager)) to coordinate message consumption, then you can find theFencedLock.getCurrentToken()of the consumer in theMessage.getMetaData()under keyMessageMetaData.FENCED_LOCK_TOKEN- Specified by:
consumein interfaceInbox- Parameters:
messageConsumer- the message consumer. SeePatternMatchingMessageHandler- Returns:
- this inbox instance
-
setMessageConsumer
Description copied from interface:InboxSet the message consumer. To start consuming callInbox.startConsuming()- Specified by:
setMessageConsumerin interfaceInbox- Parameters:
messageConsumer- the message consumer. SeePatternMatchingMessageHandler- Returns:
- this inbox instance
-
startConsuming
Description copied from interface:InboxStart consuming messages from theInbox. Requires callingInbox.setMessageConsumer(Consumer)first
If anOrderedMessageis delivered via anInboxusing aFencedLock(such asInboxes.durableQueueBasedInboxes(DurableQueues, FencedLockManager)) to coordinate message consumption, then you can find theFencedLock.getCurrentToken()of the consumer in theMessage.getMetaData()under keyMessageMetaData.FENCED_LOCK_TOKEN- Specified by:
startConsumingin interfaceInbox- Returns:
- this inbox instance
-
hasAMessageConsumer
public boolean hasAMessageConsumer()Description copied from interface:InboxHas the instance been created with a Message consumer or hasInbox.consume(Consumer)been called- Specified by:
hasAMessageConsumerin interfaceInbox- Returns:
- Has the instance been created with a Message consumer or has
Inbox.consume(Consumer)been called
-
isConsumingMessages
public boolean isConsumingMessages()Description copied from interface:InboxIs the provided Message consumer consuming messages from theInbox- Specified by:
isConsumingMessagesin interfaceInbox- Returns:
- Is the provided Message consumer consuming messages from the
Inbox
-
stopConsuming
Description copied from interface:InboxStop consuming messages from theInbox. Calling this method will remove the message consumer and to resume message consumption you need to callInbox.consume(Consumer)- Specified by:
stopConsumingin interfaceInbox- Returns:
- this inbox instance
-
name
Description copied from interface:InboxThe name of the inbox -
addMessageReceived
Description copied from interface:InboxRegister or add a message that has been received
This message will be stored durably (without any duplication check) in connection with the currently activeUnitOfWork(or a newUnitOfWorkwill be created in case no there isn't an activeUnitOfWork).
The message will be delivered asynchronously to the message consumer- Specified by:
addMessageReceivedin interfaceInbox- Parameters:
message- the message- Returns:
- this inbox instance
- See Also:
-
getNumberOfUndeliveredMessages
public long getNumberOfUndeliveredMessages()Description copied from interface:InboxGet the number of message received that haven't been processed yet (or successfully processed) by the message consumer- Specified by:
getNumberOfUndeliveredMessagesin interfaceInbox- Returns:
- the number of message received that haven't been processed yet (or successfully processed) by the message consumer
-
toString
-