Class ReceiveRequest
- java.lang.Object
-
- fr.dyade.aaa.agent.Notification
-
- fr.dyade.aaa.agent.CallbackNotification
-
- org.objectweb.joram.mom.notifications.AbstractNotification
-
- org.objectweb.joram.mom.notifications.AbstractRequestNot
-
- org.objectweb.joram.mom.notifications.ReceiveRequest
-
- All Implemented Interfaces:
Encodable,Serializable,Cloneable
public final class ReceiveRequest extends AbstractRequestNot
AReceiveRequestinstance is used by a client agent for requesting a message on a queue.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleanautoAckIftrue, the consumed message will be immediately deleted on the queue.private longexpirationTimeThe expiration time of the request.private intmsgCountprivate String[]msgIdsprivate AgentIdrequesterIdentifier of the client requesting a message, set by the queue if storing the request.private StringselectorString selector for filtering messages, null or empty for no selection.private static longserialVersionUIDprivate longtimeOutThe time-to-live value in milliseconds, during which a receive request is valid.-
Fields inherited from class fr.dyade.aaa.agent.Notification
detachable, detached, persistent
-
Fields inherited from interface fr.dyade.aaa.common.encoding.Encodable
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
-
-
Constructor Summary
Constructors Constructor Description ReceiveRequest()Used by the encoding framework.ReceiveRequest(int clientContext, int requestId, String selector, long timeOut, boolean autoAck, String[] msgIds, int msgCount)Constructs aReceiveRequestinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecode(Decoder decoder)Decodes the object.voidencode(Encoder encoder)Encodes the object.booleangetAutoAck()Checks the autoAck mode of this request.intgetClassId()intgetEncodedSize()Returns the size of the encoded object.intgetMessageCount()String[]getMessageIds()AgentIdgetRequester()StringgetSelector()Returns the selector of the request.longgetTimeOut()Returns the time-to-live parameter of this request, in milliseconds (0 for immediate delivery, negative for infinite validity).booleanisValid(long currentTime)Returnsfalseif the request expired.voidsetExpiration(long startTime)Updates the expiration time field, if needed.voidsetRequester(AgentId requester)-
Methods inherited from class org.objectweb.joram.mom.notifications.AbstractRequestNot
getRequestId, toString
-
Methods inherited from class org.objectweb.joram.mom.notifications.AbstractNotification
getClientContext, setPersistent
-
Methods inherited from class fr.dyade.aaa.agent.CallbackNotification
done, failed, hasCallback, passCallback, setCountDownCallback
-
Methods inherited from class fr.dyade.aaa.agent.Notification
clone, getContext, getDeadNotificationAgentId, getEncodableClassId, getExpiration, getMessageId, getPriority, isPersistent, setContext, setDeadNotificationAgentId, setPriority, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
selector
private String selector
String selector for filtering messages, null or empty for no selection.
-
timeOut
private long timeOut
The time-to-live value in milliseconds, during which a receive request is valid.
-
expirationTime
private long expirationTime
The expiration time of the request.
-
autoAck
private boolean autoAck
Iftrue, the consumed message will be immediately deleted on the queue.
-
requester
private AgentId requester
Identifier of the client requesting a message, set by the queue if storing the request.
-
msgIds
private String[] msgIds
-
msgCount
private int msgCount
-
-
Constructor Detail
-
ReceiveRequest
public ReceiveRequest()
Used by the encoding framework.
-
ReceiveRequest
public ReceiveRequest(int clientContext, int requestId, String selector, long timeOut, boolean autoAck, String[] msgIds, int msgCount)Constructs aReceiveRequestinstance.- Parameters:
clientContext- Identifies a client context.requestId- Request identifier.selector- Selector expression for filtering messages, null or empty for no selection.timeOut- Time-to-live value. For immediate delivery, should be set to 0. For infinite time-to-live, should be negative.autoAck-truefor immediately acknowledging the delivered message on the queue,falseotherwise.
-
-
Method Detail
-
setRequester
public void setRequester(AgentId requester)
- Parameters:
requester- the requester to set
-
getRequester
public AgentId getRequester()
- Returns:
- the requester
-
getSelector
public String getSelector()
Returns the selector of the request.
-
getTimeOut
public long getTimeOut()
Returns the time-to-live parameter of this request, in milliseconds (0 for immediate delivery, negative for infinite validity).
-
getAutoAck
public boolean getAutoAck()
Checks the autoAck mode of this request.
-
getMessageIds
public final String[] getMessageIds()
-
setExpiration
public void setExpiration(long startTime)
Updates the expiration time field, if needed. This method calculate the expiration time of the request from the current time (1st argument) and the timeout attribute.- Overrides:
setExpirationin classNotification- Parameters:
startTime- The starting time to calculate the expiration time.
-
isValid
public boolean isValid(long currentTime)
Returnsfalseif the request expired.- Parameters:
currentTime- The current time to verify the expiration time.
-
getMessageCount
public final int getMessageCount()
-
getClassId
public int getClassId()
-
getEncodedSize
public int getEncodedSize() throws ExceptionDescription copied from class:NotificationReturns the size of the encoded object.- Specified by:
getEncodedSizein interfaceEncodable- Overrides:
getEncodedSizein classAbstractRequestNot- Returns:
- the size of the encoded object
- Throws:
Exception- if an error occurs
-
encode
public void encode(Encoder encoder) throws Exception
Description copied from class:NotificationEncodes the object.- Specified by:
encodein interfaceEncodable- Overrides:
encodein classAbstractRequestNot- Parameters:
encoder- the encoder- Throws:
Exception- if an error occurs
-
decode
public void decode(Decoder decoder) throws Exception
Description copied from class:NotificationDecodes the object.- Specified by:
decodein interfaceEncodable- Overrides:
decodein classAbstractRequestNot- Parameters:
decoder- the encoder- Throws:
Exception- if an error occurs
-
-