Interface MessageQueueService
- All Superinterfaces:
Service
public interface MessageQueueService extends Service
Allows for the enqueuing of new Messages, and the pausing/unpausing of existing queues.
-
Method Summary
Modifier and Type Method Description void
await(java.lang.Long sysMsgId, long intervalInMillis, long maxAwaitInMillis)
Given a message sys id, waits for the Message to complete its Dequeue operation.void
enqueue(Message message, PlatformUserContext context)
Enqueues a message into the owning queue of Message.void
markProcessed(java.util.Collection<Message> messages, PlatformUserContext context)
Forcibly marks the given Messages as having been processed without doing any actual processing.Message
newMessage()
Creates a new message in memory which can be enqueued viaenqueue(Message, PlatformUserContext)
QueueRef
newQueueRef(long vcId, java.lang.String name, java.lang.String enterpriseName)
Creates a new QueueRef in memory which can be used for message processing after setting valid values.void
pause(java.util.Collection<QueueRef> queueRefs, PlatformUserContext context)
Pauses the given queues - you can still enqueue messages into a paused queue, but no messages will be dequeued until it is unpaused.QueueRef
queueRefFromJSON(org.json.JSONObject json)
Converts a JSON into a QueueRef.void
unpause(java.util.Collection<QueueRef> queueRefs, PlatformUserContext context)
Unpauses the given queues - you can still enqueue messages into a paused queue, but no messages will be dequeued until it is unpaused.
-
Method Details
-
enqueue
Enqueues a message into the owning queue of Message.- Parameters:
message
- in-memory JAXB representation of the Message to be persisted; do *not* write this to the DB before calling; this API will write it to the DB- Throws:
MessageQueueServiceException
-
pause
void pause(java.util.Collection<QueueRef> queueRefs, PlatformUserContext context) throws MessageQueueServiceExceptionPauses the given queues - you can still enqueue messages into a paused queue, but no messages will be dequeued until it is unpaused. The pause operation is persistent. Pausing an already-paused queue is a no-op.- Throws:
MessageQueueServiceException
-
unpause
void unpause(java.util.Collection<QueueRef> queueRefs, PlatformUserContext context) throws MessageQueueServiceExceptionUnpauses the given queues - you can still enqueue messages into a paused queue, but no messages will be dequeued until it is unpaused. The unpause operation is persistent. Unpausing an already-active queue is a no-op.- Throws:
MessageQueueServiceException
-
markProcessed
void markProcessed(java.util.Collection<Message> messages, PlatformUserContext context) throws MessageQueueServiceExceptionForcibly marks the given Messages as having been processed without doing any actual processing. (Effectively removes it from the active queue.) Message should have id and sender populated to uniquely identify the message.- Parameters:
messages
- messages with id and sender populated- Throws:
MessageQueueServiceException
-
newMessage
Message newMessage()Creates a new message in memory which can be enqueued viaenqueue(Message, PlatformUserContext)
- Returns:
- new
Message
with id field populated
-
newQueueRef
Creates a new QueueRef in memory which can be used for message processing after setting valid values.- Parameters:
vcId
- id of the value chain which owns the queuename
- name of the queueenterpriseName
- if the queue is enterprise-specific, the enterprise name. may be null- Returns:
QueueRef
-
queueRefFromJSON
Converts a JSON into a QueueRef. Properties are: vcId (required) - value chain id entName (optional) - owning enterprise name name (required) - queue name -
await
void await(java.lang.Long sysMsgId, long intervalInMillis, long maxAwaitInMillis) throws MessageWaitExceptionGiven a message sys id, waits for the Message to complete its Dequeue operation. For inbound that means completing processing, for outbound it means completing delivery. Polls at the given interval, up to the given max amount of time.- Parameters:
sysMsgId
- surrogate id of the message to wait onintervalInMillis
- polling interval to check on status, in millisecondsmaxAwaitInMillis
- max time to wait on the message before throwing an exception- Throws:
MessageWaitException
- thrown if the interval elapses without the task completing
-