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
public class Inboxes.DurableQueueBasedInboxes.DurableQueueBasedInbox extends Object implements Inbox
-
-
Field Summary
Fields Modifier and Type Field Description InboxConfigconfigQueueNameinboxQueueName
-
Constructor Summary
Constructors Constructor Description DurableQueueBasedInbox(InboxConfig config)DurableQueueBasedInbox(InboxConfig config, Consumer<Message> messageConsumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessageReceived(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 consumerInboxconsume(Consumer<Message> messageConsumer)Start consuming messages from the Outbox using the provided message consumer.
Only needs to be called if the instance was created without a message consumerlonggetNumberOfUndeliveredMessages()Get the number of message received that haven't been processed yet (or successfully processed) by the message consumerbooleanhasAMessageConsumer()Has the instance been created with a Message consumer or hasInbox.consume(Consumer)been calledbooleanisConsumingMessages()Is the provided Message consumer consuming messages from theOutboxInboxNamename()The name of the inboxvoidstopConsuming()Stop consuming messages from theOutbox.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface dk.cloudcreate.essentials.components.foundation.messaging.eip.store_and_forward.Inbox
addMessageReceived, addMessageReceived
-
-
-
-
Field Detail
-
inboxQueueName
public final QueueName inboxQueueName
-
config
public final InboxConfig config
-
-
Constructor Detail
-
DurableQueueBasedInbox
public DurableQueueBasedInbox(InboxConfig config, Consumer<Message> messageConsumer)
-
DurableQueueBasedInbox
public DurableQueueBasedInbox(InboxConfig config)
-
-
Method Detail
-
consume
public Inbox consume(Consumer<Message> messageConsumer)
Description copied from interface:InboxStart consuming messages from the Outbox using the provided message consumer.
Only needs to be called if the instance was created without a message consumerIf 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
-
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 theOutbox- Specified by:
isConsumingMessagesin interfaceInbox- Returns:
- Is the provided Message consumer consuming messages from the
Outbox
-
stopConsuming
public void stopConsuming()
Description copied from interface:InboxStop consuming messages from theOutbox. Calling this method will remove the message consumer and to resume message consumption you need to callInbox.consume(Consumer)- Specified by:
stopConsumingin interfaceInbox
-
addMessageReceived
public void addMessageReceived(Message message)
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- See Also:
OrderedMessage
-
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
-
-