Package com.documentum.fc.client.mq
Interface IDfMessageQueue
public interface IDfMessageQueue
Created by IntelliJ IDEA. User: fanz Date: March 8, 2011 Time: 10:13:25 AM To change this template use File | Settings
| File Templates.
-
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledge(IDfMessage message, boolean success, String description) Acknoeledges to message queue the delivery status of the specified message.voidacknowledge(Collection<IDfMessage> messages, boolean success, String description) Acknowledges to message server the delivery status of the specified message.Returns the next ready message with the highest priority and the earliest creation_time, sets the message to 'acquired' state.acquireNext(String recipient) Returns the next available ready message with the highest priority and earliest creation time that is addressed the specified recipient.acquireNextBatch(int batchSize) Returns as a collection the next uptocountready messages with the highest priority and earliest creation_time, sets their state to 'acquired'.acquireNextBatch(int batchSize, String recipient) Returns as a collection the next uptocountready message whose recipient matches the specified message recipient, sets their state to 'acquired'.Creates a message object that implements IDfMessage.get(int state) Returns as a collection all the messages in the given state. if any,nullotherwiseReturns the message for the given message id.Returns as a collection all the messages that satisfy the specified predicates.Returns the configuration object of this message queue.intgetCount(int state) Returns the number of the messages in the specified state.intReturns the number of the messages that satisfy the specified predicatesintpurge(int state) Deletes from the queue all the messages that are in the specified state.intDeletes the specified message from the queue.intpurgeAll()Deletes all the messages from the queue.voidsave(IDfMessage msg) Adds a message to the queue.
-
Method Details
-
createMessage
Creates a message object that implements IDfMessage.- Returns:
- A message object that implements IDfMessage.
- Throws:
DfException- if a server error occurs
-
save
Adds a message to the queue. This causes the message to be persisted in the underlying database.- Parameters:
msg- A message object.- Throws:
DfException- if a server error occurs
-
acquireNext
Returns the next ready message with the highest priority and the earliest creation_time, sets the message to 'acquired' state.- Returns:
- A message object if available,
nullif there is no such a message available. - Throws:
DfException- if a server error occurs
-
acquireNext
Returns the next available ready message with the highest priority and earliest creation time that is addressed the specified recipient. Sets the message to 'acquired' state.- Parameters:
recipient- Message recipient.- Returns:
- A message object if one with matching recipient available,
nullotherwise. - Throws:
DfException- if a server error occurs
-
acquireNextBatch
Returns as a collection the next uptocountready messages with the highest priority and earliest creation_time, sets their state to 'acquired'. Returnsnullif there are no ready messages.- Parameters:
batchSize- Number of messages to acquire.- Returns:
- Returns as a collection the next upto
countmessages,nullif there are no ready messages. - Throws:
DfException- if a server error occurs
-
acquireNextBatch
Returns as a collection the next uptocountready message whose recipient matches the specified message recipient, sets their state to 'acquired'. If there are more thancountmatching messages available, return the ones with the highest priority and earliest creation_time. Returnsnullif there are no matching messages available.- Parameters:
recipient- Message recipient name.batchSize- Number of messages to acquire.- Returns:
- A collection of message objects if any available,
nullif no messages available. - Throws:
DfException- if a server error occurs
-
acknowledge
Acknoeledges to message queue the delivery status of the specified message. If delivery succeeds, the message is deleted from the queue immediatly. If delivery fails and the queue is configured to redeliver, and the redelivery count has not excceeded the configured retry limit, the message is set to ready state for redelivery. If delivery fails and the queue is configured not to redeliver or the redelivery count has excceeded the configured retry limit, the message is deleted from the queue.- Parameters:
message- A message object.success- Whether message delivery is successfultrueor notfalsedescription- A text string describing why message delivery failed.nullin case message delivery succeeds.- Throws:
DfException- if a server error occurs
-
acknowledge
void acknowledge(Collection<IDfMessage> messages, boolean success, String description) throws DfException Acknowledges to message server the delivery status of the specified message. If delivery succeeds, the message is deleted from the queue immediatly. If delivery fails and the queue is configured to redeliver, and the redelivery count has not exceeded the configured retry limit, the message is set to ready state for redelivery. If delivery fails and the queue is configured not to redeliver or the redelivery count has exceeded the configured retry limit, the message will be deleted from the queue. This is the batch version of @acknowledge Note that this method can be used only if all messages have the same delivery status, i.e., either all succeed or fail.- Parameters:
messages- A collection of of message objects.success- Whether message delivery is successfultrueor notfalsedescription- A text string describing why message delivery failed.nullin case message delivery succeeds.- Throws:
DfException- if a server error occurs
-
get
Returns as a collection all the messages that satisfy the specified predicates. This operation does not change message state. A message returned by this method is not guranteed to remain in the queue after the method return. It may be acquired or purged by aother session.- Parameters:
predicate- A predicate that can be used in the where clause of a SQL statement. For instance, "msg_state=2 AND msg_recipient='tuser2'".- Returns:
- A collection of message objects.
- Throws:
DfException- if a server error occurs
-
get
Returns the message for the given message id. This operation does not change message state. A message returned by this method is not guranteed to remain in the queue after the method return. It may be acquired or purged by aother session.- Parameters:
msgId- Message object id.- Returns:
- The message for the given message id.
- Throws:
DfException- if a server error occurs
-
get
Returns as a collection all the messages in the given state. if any,nullotherwise This operation does not change message state. A message returned by this method is not guranteed to remain in the queue after the method return. It may be acquired or purged by aother session.- Parameters:
state- An integer value indicating message state: Valiad values are: 1(ready), 2(acquired), 3(dead), and 4(unknow)- Returns:
- A collection of all the messages.
- Throws:
DfException- if a server error occurs
-
purge
Deletes the specified message from the queue.- Parameters:
msgId- The message object id.- Returns:
- 1 if the message is deleted, 0 otherwise.
- Throws:
DfException- if a server error occurs
-
purge
Deletes from the queue all the messages that are in the specified state. Can be called by users with administer privilede only.- Parameters:
state- Message state- Returns:
- Number of messages deleted.
- Throws:
DfException- if a server error occurs
-
purgeAll
Deletes all the messages from the queue. Can be called by users with administer privilede only.- Returns:
- Number of messages deleted.
- Throws:
DfException- if a server error occurs
-
getCount
Returns the number of the messages in the specified state.- Parameters:
state- Message state- Returns:
- The number of the messages in the specified state.
- Throws:
DfException- if a server error occurs
-
getCount
Returns the number of the messages that satisfy the specified predicates- Parameters:
predicates- Predicates used in where clause- Returns:
- The number of the messages that satisfy the specified predicate.
- Throws:
DfException- if a server error occurs
-
getConfig
Returns the configuration object of this message queue.- Returns:
- Message queue configuration object.
- Throws:
DfException- if a server error occurs
-