|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.mom.proxies.ClientSubscription
class ClientSubscription
The ClientSubscription
class holds the data of a client
subscription, and the methods managing the delivery and acknowledgement
of the messages.
Field Summary | |
---|---|
private boolean |
active
true if the subscription is active. |
private int |
contextId
Identifier of the subscription context. |
private java.util.Map |
deliveredIds
Table of delivered messages identifiers. |
private java.util.Map |
deniedMsgs
Table keeping the denied messages identifiers. |
private AgentId |
dmqId
Identifier of the subscriber's dead message queue, null for
DMQ not set. |
private boolean |
durable
true if the subscription is durable. |
static org.objectweb.util.monolog.api.Logger |
logger
|
private java.util.List |
messageIds
Vector of identifiers of the messages to deliver. |
private java.util.Map |
messagesTable
Proxy messages table. |
private java.lang.String |
name
The subscription name. |
protected int |
nbMaxMsg
Max number of Message stored in the queue (-1 no limit). |
protected long |
nbMsgsDeliveredSinceCreation
the number of delivered messages |
protected long |
nbMsgsSentToDMQSinceCreation
the number of erroneous messages forwarded to the DMQ |
private boolean |
noFiltering
true if the subscription does not filter messages
in any way. |
private boolean |
noLocal
true if the subscriber does not wish to consume
messages published in the same context. |
private ProxyAgentItf |
proxy
|
private AgentId |
proxyId
The proxy's agent identifier. |
private long |
requestExpTime
Expiration time of the "receive" request, if any. |
private int |
requestId
Identifier of the request requesting messages, either the listener's request, or a "receive" request. |
private java.lang.String |
selector
The selector for filtering messages. |
private static long |
serialVersionUID
define serialVersionUID for interoperability |
private int |
subRequestId
Identifier of the subscription request. |
private int |
threshold
Threshold above which messages are considered as undeliverable because constantly denied. 0 stands for no threshold, -1 for value not set (use servers' default value). |
private boolean |
toListener
true if the messages are destinated to a listener. |
private AgentId |
topicId
The topic identifier. |
Constructor Summary | |
---|---|
ClientSubscription(AgentId proxyId,
int contextId,
int reqId,
boolean durable,
AgentId topicId,
java.lang.String name,
java.lang.String selector,
boolean noLocal,
AgentId dmqId,
int threshold,
int nbMaxMsg,
java.util.Map messagesTable)
Constructs a ClientSubscription instance. |
Method Summary | |
---|---|
(package private) void |
acknowledge(java.util.Iterator acks)
Acknowledges messages. |
(package private) void |
acknowledge(java.lang.String id)
|
(package private) void |
browseNewMessages(java.util.List newMessages)
Browses messages and keeps those which will have to be delivered to the subscriber. |
(package private) void |
cleanMessageIds()
|
void |
clear()
Deletes all messages |
(package private) void |
deactivate()
De-activates the subscription, denies the non acknowledged messages. |
private void |
decrAckCounters(java.lang.String msgId,
Message message)
|
(package private) void |
delete()
Decreases the subscription's messages acknowledgement expectations, deletes those not to be consumed anymore. |
void |
deleteMessage(java.lang.String msgId)
Deletes a particular pending message in the subscription. |
(package private) ConsumerMessages |
deliver()
Launches a delivery sequence, either for a listener, or for a receiver. |
(package private) void |
deny(java.util.Iterator denies)
Denies messages. |
private void |
deny(java.util.Iterator denies,
boolean remove)
Denies the messages. |
boolean |
getActive()
Returns true if the subscription is active. |
int |
getContextId()
Returns the subscription's context identifier. |
boolean |
getDurable()
Returns true if the subscription is durable. |
javax.management.openmbean.CompositeData |
getMessage(java.lang.String msgId)
Returns the description of a particular pending message. |
java.lang.String[] |
getMessageIds()
Returns the list of message's identifiers for the subscription. |
javax.management.openmbean.TabularData |
getMessages()
Returns the description of all pending messages. |
java.util.List |
getMessagesView()
Returns the description of all pending messages. |
java.lang.String |
getName()
Returns the name of the subscription. |
int |
getNbMaxMsg()
Returns the maximum number of message for the subscription. |
long |
getNbMsgsDeliveredSinceCreation()
Returns the number of messages delivered to the client since creation time of this subscription. |
long |
getNbMsgsSentToDMQSinceCreation()
Returns the number of erroneous messages forwarded to the DMQ since creation time of this subscription. |
int |
getPendingMessageCount()
Returns the number of pending messages for the subscription. |
java.lang.String |
getSelector()
Returns the selector. |
int |
getSubRequestId()
Returns the identifier of the subscribing request. |
(package private) Message |
getSubscriptionMessage(java.lang.String msgId)
|
AgentId |
getTopicId()
Returns the identifier of the subscription topic. |
java.lang.String |
getTopicIdAsString()
Returns the identifier of the subscription topic. |
private boolean |
isUndeliverable(int deliveryAttempts)
Returns true if a given message is considered as undeliverable,
because its delivery count matches the subscription's threshold, if any, or the
server's default threshold value (if any). |
(package private) void |
reactivate(int contextId,
int reqId,
AgentId topicId,
java.lang.String selector,
boolean noLocal)
Reactivates the subscription. |
void |
readBag(java.io.ObjectInputStream in)
|
(package private) void |
reinitialize(java.util.Map messagesTable,
java.util.List persistedMessages,
boolean denyDeliveredMessages)
Re-initializes the client subscription. |
(package private) Message |
removeMessage(java.lang.String msgId)
Removes a particular pending message in the subscription. |
private void |
save()
|
(package private) void |
setActive(boolean active)
|
(package private) void |
setDMQId(AgentId dmqId)
Sets the subscription's dead message queue identifier. |
(package private) void |
setListener(int requestId)
Sets a listener. |
void |
setNbMaxMsg(int nbMaxMsg)
Sets the maximum number of message for the subscription. |
(package private) void |
setProxyAgent(ProxyAgentItf px)
|
(package private) void |
setReceiver(int requestId,
long timeToLive)
Sets a receiver request. |
(package private) void |
setThreshold(int threshold)
Sets the subscription's threshold value. |
java.lang.String |
toString()
|
(package private) void |
unsetListener()
Unsets the listener. |
(package private) void |
unsetReceiver()
Unsets a receiver request. |
void |
writeBag(java.io.ObjectOutputStream out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static org.objectweb.util.monolog.api.Logger logger
private AgentId proxyId
private boolean durable
true
if the subscription is durable.
private AgentId topicId
private java.lang.String name
private java.lang.String selector
private AgentId dmqId
null
for
DMQ not set.
private int threshold
protected int nbMaxMsg
private java.util.List messageIds
private java.util.Map deliveredIds
private java.util.Map deniedMsgs
private transient int contextId
private transient int subRequestId
private transient boolean noLocal
true
if the subscriber does not wish to consume
messages published in the same context.
private transient boolean noFiltering
true
if the subscription does not filter messages
in any way.
private transient boolean active
true
if the subscription is active.
private transient int requestId
private transient boolean toListener
true
if the messages are destinated to a listener.
private transient long requestExpTime
private transient java.util.Map messagesTable
private transient ProxyAgentItf proxy
protected long nbMsgsSentToDMQSinceCreation
protected long nbMsgsDeliveredSinceCreation
Constructor Detail |
---|
ClientSubscription(AgentId proxyId, int contextId, int reqId, boolean durable, AgentId topicId, java.lang.String name, java.lang.String selector, boolean noLocal, AgentId dmqId, int threshold, int nbMaxMsg, java.util.Map messagesTable)
ClientSubscription
instance.
proxyId
- Proxy's identifier.contextId
- Context identifier.reqId
- Request identifier.durable
- true
for a durable subscription.topicId
- Topic identifier.name
- Subscription's name.selector
- Selector for filtering messages.noLocal
- true
for not consuming messages published
within the same proxy's context.dmqId
- Identifier of the proxy's dead message queue, if any.threshold
- Proxy's threshold value, if any.messagesTable
- Proxy's messages table.Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public int getContextId()
getContextId
in interface ClientSubscriptionMBean
public int getSubRequestId()
getSubRequestId
in interface ClientSubscriptionMBean
public java.lang.String getName()
getName
in interface ClientSubscriptionMBean
public AgentId getTopicId()
public java.lang.String getTopicIdAsString()
getTopicIdAsString
in interface ClientSubscriptionMBean
public java.lang.String getSelector()
getSelector
in interface ClientSubscriptionMBean
public boolean getDurable()
true
if the subscription is durable.
getDurable
in interface ClientSubscriptionMBean
public boolean getActive()
true
if the subscription is active.
getActive
in interface ClientSubscriptionMBean
public int getNbMaxMsg()
getNbMaxMsg
in interface ClientSubscriptionMBean
public void setNbMaxMsg(int nbMaxMsg)
setNbMaxMsg
in interface ClientSubscriptionMBean
nbMaxMsg
- the maximum number of message for subscription (-1 set
no limit).public int getPendingMessageCount()
getPendingMessageCount
in interface ClientSubscriptionMBean
public java.lang.String[] getMessageIds()
getMessageIds
in interface ClientSubscriptionMBean
void setProxyAgent(ProxyAgentItf px)
void reinitialize(java.util.Map messagesTable, java.util.List persistedMessages, boolean denyDeliveredMessages)
messagesTable
- Proxy's table where storing the messages.persistedMessages
- Proxy's persisted messages.denyDeliveredMessages
- Denies already delivered messages.void reactivate(int contextId, int reqId, AgentId topicId, java.lang.String selector, boolean noLocal)
context
- Re-activation context.reqId
- Re-activation request identifier.topicId
- Topic identifier.selector
- Selector for filtering messages.noLocal
- true
for not consuming messages published
within the same proxy's context.void deactivate()
void setActive(boolean active)
void setListener(int requestId)
requestId
- Identifier of the listener request.void unsetListener()
void setReceiver(int requestId, long timeToLive)
requestId
- Identifier of the "receive" request.timeToLive
- Request's time to live value.void unsetReceiver()
void setDMQId(AgentId dmqId)
void setThreshold(int threshold)
void browseNewMessages(java.util.List newMessages)
ConsumerMessages deliver()
void acknowledge(java.util.Iterator acks)
void acknowledge(java.lang.String id)
void deny(java.util.Iterator denies)
private void deny(java.util.Iterator denies, boolean remove)
denies
- all ids of the messages to denyremove
- true to remove messages from deliveredIds map. Must be false
when denies iterates over deliveredIds map keys, to avoid a
ConcurrentModificationException.void delete()
private boolean isUndeliverable(int deliveryAttempts)
true
if a given message is considered as undeliverable,
because its delivery count matches the subscription's threshold, if any, or the
server's default threshold value (if any).
public long getNbMsgsSentToDMQSinceCreation()
ClientSubscriptionMBean
getNbMsgsSentToDMQSinceCreation
in interface ClientSubscriptionMBean
public long getNbMsgsDeliveredSinceCreation()
ClientSubscriptionMBean
getNbMsgsDeliveredSinceCreation
in interface ClientSubscriptionMBean
Message getSubscriptionMessage(java.lang.String msgId)
public javax.management.openmbean.CompositeData getMessage(java.lang.String msgId) throws java.lang.Exception
getMessage
in interface ClientSubscriptionMBean
msgId
- The unique message's identifier.
java.lang.Exception
MessageJMXWrapper
public javax.management.openmbean.TabularData getMessages() throws java.lang.Exception
getMessages
in interface ClientSubscriptionMBean
java.lang.Exception
MessageJMXWrapper
public java.util.List getMessagesView()
ClientSubscriptionMBean
getMessagesView
in interface ClientSubscriptionMBean
public void deleteMessage(java.lang.String msgId)
ClientSubscriptionMBean
deleteMessage
in interface ClientSubscriptionMBean
msgId
- The unique message's identifier.public void clear()
ClientSubscriptionMBean
clear
in interface ClientSubscriptionMBean
Message removeMessage(java.lang.String msgId)
msgId
- The unique message's identifier.private void decrAckCounters(java.lang.String msgId, Message message)
private void save()
public void readBag(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void writeBag(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
void cleanMessageIds()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |