org.objectweb.joram.mom.notifications
Class ReceiveRequest

java.lang.Object
  extended by fr.dyade.aaa.agent.Notification
      extended by org.objectweb.joram.mom.notifications.AbstractNotification
          extended by org.objectweb.joram.mom.notifications.AbstractRequestNot
              extended by org.objectweb.joram.mom.notifications.ReceiveRequest
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ReceiveRequest
extends AbstractRequestNot

A ReceiveRequest instance is used by a client agent for requesting a message on a queue.

See Also:
Serialized Form

Field Summary
private  boolean autoAck
          If true, the consumed message will be immediately deleted on the queue.
private  long expirationTime
          The expiration time of the request.
private  int msgCount
           
private  java.lang.String[] msgIds
           
 AgentId requester
          Identifier of the client requesting a message, set by the queue if storing the request.
private  java.lang.String selector
          String selector for filtering messages, null or empty for no selection.
private static long serialVersionUID
           
private  long timeOut
          The 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
 
Constructor Summary
ReceiveRequest(int clientContext, int requestId, java.lang.String selector, long timeOut, boolean autoAck, java.lang.String[] msgIds, int msgCount)
          Constructs a ReceiveRequest instance.
 
Method Summary
 boolean getAutoAck()
          Checks the autoAck mode of this request.
 int getMessageCount()
           
 java.lang.String[] getMessageIds()
           
 java.lang.String getSelector()
          Returns the selector of the request.
 long getTimeOut()
          Returns the time-to-live parameter of this request, in milliseconds (0 for immediate delivery, negative for infinite validity).
 boolean isValid(long currentTime)
          Returns false if the request expired.
 void setExpiration(long startTime)
          Updates the expiration time field, if needed.
 
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.Notification
clone, getContext, getDeadNotificationAgentId, getExpiration, getMessageId, getPriority, isPersistent, setContext, setDeadNotificationAgentId, setPriority, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

selector

private java.lang.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
If true, the consumed message will be immediately deleted on the queue.


requester

public AgentId requester
Identifier of the client requesting a message, set by the queue if storing the request.


msgIds

private java.lang.String[] msgIds

msgCount

private int msgCount
Constructor Detail

ReceiveRequest

public ReceiveRequest(int clientContext,
                      int requestId,
                      java.lang.String selector,
                      long timeOut,
                      boolean autoAck,
                      java.lang.String[] msgIds,
                      int msgCount)
Constructs a ReceiveRequest instance.

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 - true for immediately acknowledging the delivered message on the queue, false otherwise.
Method Detail

getSelector

public java.lang.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 java.lang.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:
setExpiration in class Notification
Parameters:
startTime - The starting time to calculate the expiration time.

isValid

public boolean isValid(long currentTime)
Returns false if the request expired.

Parameters:
currentTime - The current time to verify the expiration time.

getMessageCount

public final int getMessageCount()


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.