public class ReceiveRequest extends AbstractRequestNot
ReceiveRequest
instance is used by a client agent for
requesting a message on a queue.Modifier and Type | Field and Description |
---|---|
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 String[] |
msgIds |
AgentId |
requester
Identifier of the client requesting a message, set by the queue if
storing the request.
|
private 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.
|
detachable, detached, persistent
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
Constructor and Description |
---|
ReceiveRequest()
Used by the encoding framework.
|
ReceiveRequest(int clientContext,
int requestId,
String selector,
long timeOut,
boolean autoAck,
String[] msgIds,
int msgCount)
Constructs a
ReceiveRequest instance. |
Modifier and Type | Method and Description |
---|---|
void |
decode(Decoder decoder)
Decodes the object.
|
void |
encode(Encoder encoder)
Encodes the object.
|
boolean |
getAutoAck()
Checks the autoAck mode of this request.
|
int |
getClassId() |
int |
getEncodedSize()
Returns the size of the encoded object.
|
int |
getMessageCount() |
String[] |
getMessageIds() |
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.
|
getRequestId, toString
getClientContext, setPersistent
done, failed, hasCallback, passCallback, setCountDownCallback
clone, getContext, getDeadNotificationAgentId, getEncodableClassId, getExpiration, getMessageId, getPriority, isPersistent, setContext, setDeadNotificationAgentId, setPriority, toString
private static final long serialVersionUID
private String selector
private long timeOut
private long expirationTime
private boolean autoAck
true
, the consumed message will be immediately
deleted on the queue.public AgentId requester
private String[] msgIds
private int msgCount
public ReceiveRequest()
public ReceiveRequest(int clientContext, int requestId, String selector, long timeOut, boolean autoAck, String[] msgIds, int msgCount)
ReceiveRequest
instance.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.public String getSelector()
public long getTimeOut()
public boolean getAutoAck()
public final String[] getMessageIds()
public void setExpiration(long startTime)
setExpiration
in class Notification
startTime
- The starting time to calculate the expiration time.public boolean isValid(long currentTime)
false
if the request expired.currentTime
- The current time to verify the expiration time.public final int getMessageCount()
public int getClassId()
public int getEncodedSize() throws Exception
Notification
getEncodedSize
in interface Encodable
getEncodedSize
in class AbstractRequestNot
Exception
- if an error occurspublic void encode(Encoder encoder) throws Exception
Notification
encode
in interface Encodable
encode
in class AbstractRequestNot
encoder
- the encoderException
- if an error occurspublic void decode(Decoder decoder) throws Exception
Notification
decode
in interface Encodable
decode
in class AbstractRequestNot
decoder
- the encoderException
- if an error occursCopyright © 2023 ScalAgent D.T.. All rights reserved.