public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgentItf
UserAgent
class implements the MOM proxy behaviour,
basically forwarding client requests to MOM destinations and MOM
destinations replies to clients.Modifier and Type | Class and Description |
---|---|
(package private) class |
UserAgent.HeartBeatTask
Timer task responsible for closing the connection if it has
not sent any requests for the duration 'timeout'.
|
(package private) class |
UserAgent.SharedCtx
This kind of SharedCts (LinkedHashMap) is well-suited to building LRU caches.
|
static class |
UserAgent.UserAgentFactory |
Modifier and Type | Field and Description |
---|---|
private ClientContext |
activeCtx
Reference to the active
ClientContext instance. |
private int |
activeCtxId
Identifier of the active context.
|
static String |
ARRIVAL_STATE_PREFIX |
private UserAgentArrivalState |
arrivalState
Counter of message arrivals from topics.
|
private WakeUpTask |
cleaningTask |
private Map<Integer,String> |
clientIDs
Map contains the clientID
|
private Hashtable |
connections
Table that contains the user connections:
- key =
Integer (connection key)
- value =
|
private Map<Integer,ClientContext> |
contexts
Table of the proxy's
ClientContext instances. |
protected Scheduler |
deliveryScheduler |
private AgentId |
dmqId
Identifier of this proxy dead message queue,
null for DMQ
not set. |
private Hashtable |
heartBeatTasks |
private List<MessageInterceptor> |
interceptorsIN |
private List<MessageInterceptor> |
interceptorsOUT
the in and out interceptors list.
|
private List<Properties> |
interceptorsPropIN |
private List<Properties> |
interceptorsPropOUT |
private int |
keyCounter
Counter of the connection keys
|
static org.objectweb.util.monolog.api.Logger |
logger |
static String |
MESSAGE_TABLE_PREFIX |
private MessageTable |
messagesTable
Table holding the subscriptions' messages.
|
private List<ClientContext> |
modifiedClientContexts
The ClientContexts to be saved after a react.
|
private List<ClientSubscription> |
modifiedClientSubscriptions
The ClientSubscriptions to be saved after a react.
|
(package private) String |
msgTxname |
private int |
nbMaxMsg
Maximum number of Message store in subscriptions (-1 set no limit).
|
private long |
nbMsgsSentToDMQSinceCreation
the number of erroneous messages forwarded to the DMQ
|
private long |
period
period to run the cleaning task, by default 60s.
|
private Map<Xid,XACnxPrepare> |
recoveredTransactions
Table holding the recovered transactions branches.
|
private static long |
serialVersionUID
define serialVersionUID for interoperability
|
private Map<String,UserAgent.SharedCtx> |
sharedSubs
Table holding the
SharedCtx instances. |
private Properties |
subsClientIDs
Key: subscription name
Value: clientID |
private Map<String,ClientSubscription> |
subsTable
Table holding the
ClientSubscription instances. |
private int |
threshold
Threshold above which messages are considered as undeliverable because
constantly denied.
|
private Map |
topicsTable
Table holding the
TopicSubscription instances. |
agentProfiling, emptyString, fixed, logmon
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
Modifier | Constructor and Description |
---|---|
|
UserAgent()
Constructs a
UserAgent instance. |
protected |
UserAgent(String name,
boolean fixed,
int stamp)
Used by the Encodable framework
|
|
UserAgent(String name,
int stamp)
Creates a new user proxy.
|
Modifier and Type | Method and Description |
---|---|
private void |
addInterceptor(String agentId,
String agentName,
String interceptorsKey,
List<MessageInterceptor> interceptors,
Properties prop,
List<Properties> interceptorsProp) |
void |
agentFinalize(boolean lastTime)
Finalizes the agent before it is garbaged.
|
void |
agentInitialize(boolean firstTime)
(Re)initializes the agent when (re)loading.
|
protected void |
agentSave()
Enables the sub-classes to save their state.
|
protected void |
cleanPendingMessages(long currentTime) |
void |
decode(Decoder decoder)
Decodes the object.
|
void |
delete()
Permits this agent to destroy itself.
|
private void |
deleteProxy(FwdAdminRequestNot not)
This method deletes the proxy by notifying its connected clients,
denying the non acknowledged messages, deleting the temporary
destinations, removing the subscriptions.
|
void |
deleteSubscriptionMessage(String subName,
String msgId)
Deletes a particular pending message in a subscription.
|
private void |
deleteTemporaryDestination(AgentId destId) |
private void |
doFwd(AgentId from,
AbstractReplyNot rep)
Distributes the JMS replies to the appropriate reactions.
|
private void |
doFwd(AgentId from,
QueueMsgReply rep)
Actually forwards a
QueueMsgReply coming from a destination
as a ConsumerMessages destinated to the requesting client. |
private void |
doFwd(AgentId from,
TopicMsgsReply rep)
Method implementing the proxy reaction to a
TopicMsgsReply
holding messages published by a topic. |
private void |
doFwd(BrowseReply rep)
Actually forwards a
BrowseReply coming from a
destination as a QBrowseReply destinated to the
requesting client. |
private void |
doFwd(SubscribeReply rep)
Forwards the topic's
SubscribeReply as a
ServerReply . |
private void |
doReact(AdminCommandRequest request,
AgentId replyTo,
String requestMsgId) |
private void |
doReact(AdminReplyNot reply)
An
AdminReply acknowledges the setting of a temporary
destination; nothing needs to be done. |
private void |
doReact(AgentId from,
ExceptionReply rep)
Actually forwards an
ExceptionReply coming from a destination
as a MomExceptionReply destinated to the requesting client. |
private void |
doReact(AgentId from,
GetClientSubscriptions not)
Used to get number of local subscribers to 'from'.
|
private void |
doReact(AgentId from,
ReconnectSubscribersNot not)
Sends reconnection messages to one or more subscribers.
|
private void |
doReact(ClearSubscription request,
AgentId replyTo,
String requestMsgId,
String replyMsgId) |
private void |
doReact(CloseConnectionNot not) |
private void |
doReact(CloseConnectionNot2 not) |
private void |
doReact(CnxStartRequest req)
Method implementing the proxy reaction to a
CnxStartRequest
requesting to start a context. |
private void |
doReact(CnxStopRequest req)
Method implementing the JMS proxy reaction to a
CnxStopRequest
requesting to stop a context. |
private void |
doReact(ConsumerAckRequest req)
Method implementing the JMS proxy reaction to a
ConsumerAckRequest acknowledging a message either on a queue
or on a subscription. |
private void |
doReact(ConsumerCloseSubRequest req)
Method implementing the JMS proxy reaction to a
ConsumerCloseSubRequest requesting to deactivate a durable
subscription. |
private void |
doReact(ConsumerDenyRequest req)
Method implementing the JMS proxy reaction to a
ConsumerDenyRequest denying
a message either on a queue or on a subscription. |
private void |
doReact(ConsumerReceiveRequest req)
Method implementing the proxy reaction to a
ConsumerReceiveRequest instance, requesting a message from a
subscription. |
private void |
doReact(ConsumerSetListRequest req)
Method implementing the JMS proxy reaction to a
ConsumerSetListRequest notifying the creation of a client
listener. |
private void |
doReact(ConsumerSubRequest req)
Method implementing the JMS proxy reaction to a
ConsumerSubRequest
requesting to subscribe to a topic. |
private void |
doReact(ConsumerUnsetListRequest req)
Method implementing the JMS proxy reaction to a
ConsumerUnsetListRequest notifying that a consumer listener
is unset. |
private void |
doReact(ConsumerUnsubRequest req)
Method implementing the JMS proxy reaction to a
ConsumerUnsubRequest requesting to remove a subscription. |
private void |
doReact(DeleteSubscriptionMessage request,
AgentId replyTo,
String requestMsgId,
String replyMsgId) |
private void |
doReact(FwdAdminRequestNot not) |
private void |
doReact(GetConnectionNot not) |
private void |
doReact(GetSubscription request,
AgentId replyTo,
String requestMsgId,
String replyMsgId) |
private void |
doReact(GetSubscriptionMessage request,
AgentId replyTo,
String requestMsgId,
String replyMsgId) |
private void |
doReact(GetSubscriptionMessageIds request,
AgentId replyTo,
String requestMsgId,
String replyMsgId) |
private void |
doReact(GetSubscriptions request,
AgentId replyTo,
String requestMsgId,
String replyMsgId) |
private void |
doReact(int key,
AbstractJmsRequest request,
CallbackNotification callbackNotification)
Distributes the client requests to the appropriate reactions.
|
private void |
doReact(int key,
ActivateConsumerRequest req) |
private void |
doReact(int key,
AddClientIDRequest req)
Method implementing the reaction to a
AddClientIDRequest
instance add the clientID value of a connection. |
private void |
doReact(int key,
CnxCloseRequest req)
The method closes a given context by denying the non acknowledged messages
delivered to this context, and deleting its temporary subscriptions and
destinations.
|
private void |
doReact(int key,
CnxConnectRequest req)
Method implementing the reaction to a
CnxConnectRequest
requesting the key of the active context. |
private void |
doReact(int key,
CommitRequest req,
CallbackNotification callbackNotification) |
private void |
doReact(int key,
GetAdminTopicRequest req)
Method implementing the reaction to a
GetAdminTopicRequest
requesting the identifier of the local admin topic. |
private void |
doReact(OpenConnectionNot not)
Registers and starts the
UserConnection . |
private void |
doReact(ProxyRequestGroupNot not) |
private void |
doReact(RequestNot not) |
private void |
doReact(ResetCollocatedConnectionsNot not) |
private void |
doReact(ReturnConnectionNot not)
Differs the reply because the connection key counter
must be saved before the OpenConnectionNot returns.
|
private void |
doReact(SendRepliesNot not) |
private void |
doReact(SendReplyNot not)
Notification sent by local agents (destinations)
indicating that the proxy can reply to a client.
|
private void |
doReact(SessAckRequest req)
Method implementing the JMS proxy reaction to a
SessAckRequest
acknowledging messages either on a queue or on a subscription. |
private void |
doReact(SessCreateDestRequest req)
Method implementing the JMS proxy reaction to a
SessCreateDestRequest
requesting the creation of a destination. |
private void |
doReact(SessDenyRequest req)
Method implementing the JMS proxy reaction to a
SessDenyRequest denying
messages either on a queue or on a subscription. |
private void |
doReact(SyncReply not)
Method implementing the JMS proxy reaction to a
SyncReply notification sent by itself, wrapping a reply
to be sent to a client. |
private void |
doReact(TempDestDeleteRequest req)
Method implementing the JMS proxy reaction to a
TempDestDeleteRequest request for deleting a temporary
destination. |
private void |
doReact(TopicDeliveryTimeNot not) |
private void |
doReact(UnknownAgent uA)
Method implementing the JMS proxy reaction to an
UnknownAgent
notification notifying that a destination does not exist or is deleted. |
private void |
doReact(XACnxCommit req)
Method implementing the JMS proxy reaction to an
XACnxCommit request committing the operations performed
in a given transaction. |
private void |
doReact(XACnxPrepare req)
Method implementing the JMS proxy reaction to an
XACnxPrepare request holding messages and acknowledgements
produced in an XA transaction. |
private void |
doReact(XACnxRecoverRequest req)
Reacts to a
XACnxRecoverRequest request requesting the
identifiers of the prepared transactions. |
private void |
doReact(XACnxRollback req)
Method implementing the JMS proxy reaction to an
XACnxRollback request rolling back the operations performed
in a given transaction. |
private void |
doReply(AbstractJmsReply reply)
Method used for sending an
AbstractJmsReply back to an
external client within the active context. |
private void |
doSetPeriod(long period) |
void |
encode(Encoder encoder)
Encodes the object.
|
protected ClientContext |
getClientContext(int ctxId) |
String |
getDMQId()
Returns the default DMQ for subscription of this user.
|
int |
getEncodableClassId()
Enables the sub classes not to implement this method.
|
int |
getEncodedSize()
Returns the size of the encoded object.
|
private StringBuffer |
getMBeanName() |
int |
getMessageTableConsumedMemory()
Returns the amount of memory consumed by the message table.
|
protected String |
getMsgTxname() |
int |
getNbMaxMsg()
Returns the default maximum number of message for the subscription of this user.
|
long |
getNbMsgsSentToDMQSinceCreation()
Returns the number of erroneous messages forwarded to the DMQ since
creation time of this proxy..
|
long |
getPeriod()
Returns the period value of this queue, -1 if not set.
|
private String |
getSubMBeanName(String name) |
String[] |
getSubscriptionNames()
Returns the list of subscriptions for this user.
|
int |
getThreshold()
Returns the default threshold for the subscription of this user.
0 stands for no threshold, -1 for value not set.
|
private void |
initialize(boolean firstTime)
(Re)initializes the proxy.
|
void |
modifiedClient(ClientContext cc) |
void |
modifiedSubscription(ClientSubscription cs) |
private ProducerMessages |
processInterceptors(int key,
ProducerMessages pm) |
void |
react(AgentId from,
Notification not)
Overrides the
Agent class react method for
providing the JMS client proxy with its specific behaviour. |
protected void |
reactToClientRequest(int key,
AbstractJmsRequest request,
CallbackNotification callbackNotification)
Method processing clients requests.
|
private void |
reactToClientRequest(int key,
ConsumerReceiveRequest req)
Either forwards the
ConsumerReceiveRequest request as a
ReceiveRequest directly to the target queue, or wraps it
and sends it to the proxy if destinated to a subscription. |
private void |
reactToClientRequest(int key,
ConsumerSetListRequest req)
Either forwards the
ConsumerSetListRequest request as a
ReceiveRequest directly to the target queue, or wraps it
and sends it to the proxy if destinated to a subscription. |
private void |
reactToClientRequest(int key,
JmsRequestGroup request) |
private void |
reactToClientRequest(int key,
ProducerMessages req,
CallbackNotification callbackNotification)
Forwards the messages sent by the client in a
ProducerMessages request as a ClientMessages
MOM request directly to a destination, and acknowledges them by sending
a ServerReply back. |
private void |
reactToClientRequest(int key,
QBrowseRequest req)
Forwards the client's
QBrowseRequest request as
a BrowseRequest MOM request directly to a destination. |
private void |
removeInterceptor(String interceptorsKey,
List<MessageInterceptor> interceptors,
String classNames,
List<Properties> interceptorsProp) |
private void |
replaceInterceptorIN(String agentId,
String agentName,
Properties prop) |
private void |
replaceInterceptorOUT(String agentId,
String agentName,
Properties prop) |
private void |
replyToTopic(AdminReply reply,
AgentId replyTo,
String requestMsgId,
String replyMsgId) |
private void |
saveModifiedClientContexts() |
private void |
saveModifiedClientSubscriptions() |
(package private) void |
scheduleDeliveryTimeMessage(AgentId from,
Message msg,
List<String> subNames) |
void |
sendNot(AgentId to,
Notification not)
Sends a notification to the specified agent.
|
void |
sendToClient(int key,
AbstractJmsReply reply)
Sends a reply to the client connected through
the specified connection.
|
private void |
sendToDMQ(Message msg,
short messageError) |
private void |
setActiveCtxId(int activeCtxId) |
private void |
setCtx(int key)
Updates the reference to the active context.
|
private void |
setDmq(ClientMessages not) |
void |
setInterceptors(Properties prop)
Only call in UserAgent creation.
|
protected void |
setMsgTxName(Message msg) |
void |
setNbMaxMsg(int nbMaxMsg)
Sets the maximum number of message for the subscription of this user.
|
void |
setNoSave()
Sets the
updated field to false so that the
agent state is not saved after the current reaction; the field is set
back to true for the next reaction. |
void |
setPeriod(long period)
Sets or unsets the period for this queue.
|
void |
setSave()
Sets the
updated field to true so that the
agent state is saved after the current reaction. |
void |
setThreshold(int threshold)
Sets the default threshold for the subscription of this user.
0 stands for no threshold, -1 for value not set.
|
String |
toString()
Returns a string representation of this user's proxy.
|
private boolean |
updateSubscriptionToTopic(AgentId topicId,
int contextId,
int requestId)
Updates the proxy's subscription to a topic.
|
private boolean |
updateSubscriptionToTopic(AgentId topicId,
int contextId,
int requestId,
boolean asyncSub)
Updates the proxy's subscription to a topic.
|
delete, delete, deploy, deploy, getAgentId, getCommitTime, getId, getLogTopic, getName, getReactNb, getReactTime, hasName, isAgentProfiling, isDeployed, isFixed, isUpdated, needToBeCommited, resetCommitTime, resetReactTime, resetTimer, save, sendTo, sendTo, sendTo, setAgentProfiling, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName
getAgentId, getCommitTime, getReactNb, getReactTime, isAgentProfiling, isFixed, resetCommitTime, resetReactTime, resetTimer, setAgentProfiling
getId
private static final long serialVersionUID
public static org.objectweb.util.monolog.api.Logger logger
public static final String ARRIVAL_STATE_PREFIX
public static final String MESSAGE_TABLE_PREFIX
private transient List<MessageInterceptor> interceptorsOUT
private transient List<MessageInterceptor> interceptorsIN
private List<Properties> interceptorsPropIN
private List<Properties> interceptorsPropOUT
private long period
private long nbMsgsSentToDMQSinceCreation
private transient List<ClientContext> modifiedClientContexts
private transient List<ClientSubscription> modifiedClientSubscriptions
private AgentId dmqId
null
for DMQ
not set.private int threshold
private int nbMaxMsg
private Map<Integer,ClientContext> contexts
ClientContext
instances.
Key: context identifier
Value: context
private Map<String,ClientSubscription> subsTable
ClientSubscription
instances.
Key: subscription name
Value: client subscription
private transient Map<String,UserAgent.SharedCtx> sharedSubs
SharedCtx
instances.
Key: subscription name
Value: the shared context
private Properties subsClientIDs
private Map<Xid,XACnxPrepare> recoveredTransactions
Key: transaction identifier
Value: XACnxPrepare
instance
private UserAgentArrivalState arrivalState
private transient Map topicsTable
TopicSubscription
instances.
Key: topic identifier
Value: topic subscription
private transient MessageTable messagesTable
Key: message identifier
Value: message
private transient int activeCtxId
private transient ClientContext activeCtx
ClientContext
instance.private transient Hashtable connections
Integer
(connection key)
- value =
private transient Hashtable heartBeatTasks
private int keyCounter
private transient WakeUpTask cleaningTask
protected transient Scheduler deliveryScheduler
transient String msgTxname
protected UserAgent(String name, boolean fixed, int stamp)
public UserAgent()
UserAgent
instance.public UserAgent(String name, int stamp)
ConnectionManager
public long getPeriod()
getPeriod
in interface UserAgentMBean
public void setPeriod(long period)
setPeriod
in interface UserAgentMBean
period
- The period value to be set or -1 for unsetting previous
value.public String getDMQId()
getDMQId
in interface UserAgentMBean
public int getThreshold()
getThreshold
in interface UserAgentMBean
public void setThreshold(int threshold)
setThreshold
in interface UserAgentMBean
threshold
- the threshold to set.public int getNbMaxMsg()
getNbMaxMsg
in interface UserAgentMBean
public void setNbMaxMsg(int nbMaxMsg)
setNbMaxMsg
in interface UserAgentMBean
nbMaxMsg
- the maximum number of message (-1 set no limit).public void agentInitialize(boolean firstTime) throws Exception
agentInitialize
in class Agent
firstTime
- true when first called by the factoryException
- unspecialized exceptionpublic void agentFinalize(boolean lastTime)
agentFinalize
in class Agent
lastTime
- true when last called by the factory on agent deletion.private StringBuffer getMBeanName()
public int getMessageTableConsumedMemory()
UserAgentMBean
getMessageTableConsumedMemory
in interface UserAgentMBean
public void react(AgentId from, Notification not) throws Exception
Agent
class react
method for
providing the JMS client proxy with its specific behaviour.
A JMS proxy specifically reacts to the following notifications:
OpenConnectionNot
protected void agentSave() throws IOException
Agent
agentSave
in class Agent
IOException
- if any error occursprivate void doReact(AgentId from, GetClientSubscriptions not)
from
- should be a Topic agent ID.not
- contains the original Admin not sent to 'from'.private void doReact(AgentId from, ReconnectSubscribersNot not)
from
- not
- private void doSetPeriod(long period)
private void doReact(OpenConnectionNot not)
UserConnection
.private void doReact(ReturnConnectionNot not)
private void doReact(GetConnectionNot not)
private void doReact(RequestNot not)
private void doReact(ProxyRequestGroupNot not)
private void doReact(CloseConnectionNot2 not)
private void doReact(CloseConnectionNot not)
private void doReact(ResetCollocatedConnectionsNot not)
private void doReact(SendRepliesNot not)
private void doReact(SendReplyNot not)
not
- public void sendNot(AgentId to, Notification not)
sendNot
in interface ProxyAgentItf
to
- the identifier of the recipient agentnot
- the notification to sendpublic void sendToClient(int key, AbstractJmsReply reply)
key
- the key of the connection the client
is connected through.reply
- the reply to send to the client.public void setNoSave()
Agent
updated
field to false
so that the
agent state is not saved after the current reaction; the field is set
back to true
for the next reaction.public void setSave()
Agent
updated
field to true
so that the
agent state is saved after the current reaction.public String toString()
toString
in interface AgentMBean
toString
in interface UserAgentMBean
toString
in class Agent
public void setInterceptors(Properties prop) throws Exception
prop
- propertiesException
private void initialize(boolean firstTime) throws Exception
firstTime
- Exception
- If the proxy state could not be fully retrieved,
leading to an inconsistent state.private void setActiveCtxId(int activeCtxId)
protected void reactToClientRequest(int key, AbstractJmsRequest request, CallbackNotification callbackNotification)
Some of the client requests are directly forwarded, some others are sent to the proxy so that their processing occurs in a transaction.
A MomExceptionReply
wrapping a DestinationException
might be sent back if a target destination can't be identified.
private void reactToClientRequest(int key, ProducerMessages req, CallbackNotification callbackNotification) throws RequestException
ProducerMessages
request as a ClientMessages
MOM request directly to a destination, and acknowledges them by sending
a ServerReply
back.RequestException
- The destination id is undefinedprivate void sendToDMQ(Message msg, short messageError)
private void setDmq(ClientMessages not)
private void reactToClientRequest(int key, ConsumerReceiveRequest req) throws RequestException
ConsumerReceiveRequest
request as a
ReceiveRequest
directly to the target queue, or wraps it
and sends it to the proxy if destinated to a subscription.RequestException
- Undefined (null) destinationprivate void reactToClientRequest(int key, ConsumerSetListRequest req) throws RequestException
ConsumerSetListRequest
request as a
ReceiveRequest
directly to the target queue, or wraps it
and sends it to the proxy if destinated to a subscription.RequestException
- Undefined (null) destinationprivate void reactToClientRequest(int key, QBrowseRequest req) throws RequestException
QBrowseRequest
request as
a BrowseRequest
MOM request directly to a destination.RequestException
- Undefined (null) destinationprivate void reactToClientRequest(int key, JmsRequestGroup request)
private void doReact(int key, AbstractJmsRequest request, CallbackNotification callbackNotification)
The proxy accepts the following requests:
GetAdminTopicRequest
CnxConnectRequest
CnxStartRequest
CnxStopRequest
SessCreateTQRequest
SessCreateTTRequest
ConsumerSubRequest
ConsumerUnsubRequest
ConsumerCloseSubRequest
ConsumerSetListRequest
ConsumerUnsetListRequest
ConsumerReceiveRequest
ConsumerAckRequest
ConsumerDenyRequest
SessAckRequest
SessDenyRequest
TempDestDeleteRequest
XACnxPrepare
XACnxCommit
XACnxRollback
XACnxRecoverRequest
A JmsExceptReply
is sent back to the client when an
exception is thrown by the reaction.
private void doReact(int key, GetAdminTopicRequest req) throws AccessException
GetAdminTopicRequest
requesting the identifier of the local admin topic.
It simply sends back a GetAdminTopicReply
holding the
admin topic identifier.
AccessException
- If the requester is not an administrator.private void doReact(int key, CnxConnectRequest req) throws DestinationException
CnxConnectRequest
requesting the key of the active context.
It simply sends back a ConnectReply
holding the active
context's key.
DestinationException
- In case of a first administrator
context, if the local administration topic reference
is not available.private void doReact(CnxStartRequest req)
CnxStartRequest
requesting to start a context.
This method sends the pending ConsumerMessages
replies,
if any.
private void doReact(CnxStopRequest req)
CnxStopRequest
requesting to stop a context.
This method sends a ServerReply
back.
private void doReact(SessCreateDestRequest req) throws RequestException
SessCreateDestRequest
requesting the creation of a destination.
Creates the queue, sends it a SetRightRequest
for granting
WRITE access to all, and wraps a SessCreateTDReply
in a
SyncReply
notification it sends to itself. This latest
action's purpose is to preserve causality.
Creates the topic, sends it a SetRightRequest
for granting
WRITE access to all, and wraps a SessCreateTDReply
in a
SyncReply
notification it sends to itself. This latest
action's purpose is to preserve causality.
RequestException
- If the destination could not be deployed.private void doReact(ConsumerSubRequest req) throws StateException, RequestException
ConsumerSubRequest
requesting to subscribe to a topic.StateException
- If activating an already active durable subscription.RequestException
- If the subscription parameters are not correct.private void doReact(ConsumerSetListRequest req) throws DestinationException
ConsumerSetListRequest
notifying the creation of a client
listener.
Sets the listener for the subscription, launches a delivery sequence.
DestinationException
- If the subscription does not exist.private void doReact(ConsumerUnsetListRequest req) throws DestinationException
ConsumerUnsetListRequest
notifying that a consumer listener
is unset.DestinationException
- If the subscription does not exist.private void doReact(ConsumerCloseSubRequest req) throws DestinationException
ConsumerCloseSubRequest
requesting to deactivate a durable
subscription.DestinationException
- If the subscription does not exist.private void doReact(ConsumerUnsubRequest req) throws DestinationException
ConsumerUnsubRequest
requesting to remove a subscription.DestinationException
- If the subscription does not exist.private void doReact(ConsumerReceiveRequest req) throws DestinationException
ConsumerReceiveRequest
instance, requesting a message from a
subscription.
This method registers the request and launches a delivery sequence.
DestinationException
- If the subscription does not exist.private void doReact(SessAckRequest req)
SessAckRequest
acknowledging messages either on a queue or on a subscription.private void doReact(SessDenyRequest req)
SessDenyRequest
denying
messages either on a queue or on a subscription.private void doReact(ConsumerAckRequest req)
ConsumerAckRequest
acknowledging a message either on a queue
or on a subscription.private void doReact(ConsumerDenyRequest req)
ConsumerDenyRequest
denying
a message either on a queue or on a subscription.
This request is acknowledged when destinated to a queue.
private void doReact(TempDestDeleteRequest req)
TempDestDeleteRequest
request for deleting a temporary
destination.
This method sends a fr.dyade.aaa.agent.DeleteNot
to the
destination and acknowledges the request.
private void deleteTemporaryDestination(AgentId destId)
private void doReact(XACnxPrepare req) throws StateException
XACnxPrepare
request holding messages and acknowledgements
produced in an XA transaction.StateException
- If the proxy has already received a prepare
order for the same transaction.private void doReact(XACnxCommit req) throws StateException
XACnxCommit
request committing the operations performed
in a given transaction.
This method actually processes the objects sent at the prepare phase, and acknowledges the request.
StateException
- If committing an unknown transaction.private void doReact(XACnxRollback req)
XACnxRollback
request rolling back the operations performed
in a given transaction.private void doReact(XACnxRecoverRequest req) throws StateException
XACnxRecoverRequest
request requesting the
identifiers of the prepared transactions.
Returns the identifiers of the recovered transactions, puts the prepared data into the active context for future commit or rollback.
StateException
- If a recovered transaction branch is already
present in the context.private void doReact(SyncReply not)
SyncReply
notification sent by itself, wrapping a reply
to be sent to a client.private void doReact(int key, CnxCloseRequest req)
private void doReact(int key, ActivateConsumerRequest req)
private void doReact(int key, CommitRequest req, CallbackNotification callbackNotification)
private void doReact(int key, AddClientIDRequest req) throws Exception
AddClientIDRequest
instance add the clientID value of a connection.Exception
private void doFwd(AgentId from, AbstractReplyNot rep)
JMS proxies react the following replies:
QueueMsgReply
BrowseReply
SubscribeReply
TopicMsgsReply
ExceptionReply
private void doFwd(AgentId from, QueueMsgReply rep)
QueueMsgReply
coming from a destination
as a ConsumerMessages
destinated to the requesting client.
If the corresponding context is stopped, stores the
ConsumerMessages
for later delivery.
private void doFwd(BrowseReply rep)
BrowseReply
coming from a
destination as a QBrowseReply
destinated to the
requesting client.private void doFwd(SubscribeReply rep)
SubscribeReply
as a
ServerReply
.protected final String getMsgTxname()
protected final void setMsgTxName(Message msg)
private void doFwd(AgentId from, TopicMsgsReply rep)
TopicMsgsReply
holding messages published by a topic.void scheduleDeliveryTimeMessage(AgentId from, Message msg, List<String> subNames)
private void doReact(TopicDeliveryTimeNot not)
private void doReact(AgentId from, ExceptionReply rep)
ExceptionReply
coming from a destination
as a MomExceptionReply
destinated to the requesting client.
If the wrapped exception is an AccessException
thrown by
a Topic
as a reply to a SubscribeRequest
,
removing the corresponding subscriptions.
private void doReact(AdminReplyNot reply)
AdminReply
acknowledges the setting of a temporary
destination; nothing needs to be done.private void doReact(UnknownAgent uA)
UnknownAgent
notification notifying that a destination does not exist or is deleted.
If it notifies of a deleted topic, the method removes the corresponding subscriptions. If the wrapped request is messages sending, the messages are sent to the DMQ.
A JmsExceptReply
is sent to the concerned requester.
This case might also happen when sending a ClientMessages
to a dead message queue. In that case, the invalid DMQ identifier is set
to null.
private void doReact(FwdAdminRequestNot not)
private void doReact(AdminCommandRequest request, AgentId replyTo, String requestMsgId)
private void doReact(GetSubscriptions request, AgentId replyTo, String requestMsgId, String replyMsgId)
public String[] getSubscriptionNames()
getSubscriptionNames
in interface UserAgentMBean
private void doReact(GetSubscriptionMessageIds request, AgentId replyTo, String requestMsgId, String replyMsgId)
private void doReact(GetSubscription request, AgentId replyTo, String requestMsgId, String replyMsgId)
private void doReact(GetSubscriptionMessage request, AgentId replyTo, String requestMsgId, String replyMsgId)
private void doReact(DeleteSubscriptionMessage request, AgentId replyTo, String requestMsgId, String replyMsgId)
public void deleteSubscriptionMessage(String subName, String msgId)
subName
- The subscription unique name.msgId
- The unique message's identifier.private void doReact(ClearSubscription request, AgentId replyTo, String requestMsgId, String replyMsgId)
private void replyToTopic(AdminReply reply, AgentId replyTo, String requestMsgId, String replyMsgId)
private void setCtx(int key) throws StateException
key
- Key of the activated context.StateException
- If the context has actually been closed or
lost.private void doReply(AbstractJmsReply reply)
AbstractJmsReply
back to an
external client within the active context.rep
- The reply to send.protected ClientContext getClientContext(int ctxId)
protected void cleanPendingMessages(long currentTime)
public void delete()
Agent
delete
in interface AgentMBean
delete
in interface UserAgentMBean
delete
in class Agent
private void deleteProxy(FwdAdminRequestNot not)
Exception
- If the requester is not an administrator.private boolean updateSubscriptionToTopic(AgentId topicId, int contextId, int requestId)
topicId
- Identifier of the topic to subscribe to.contextId
- Identifier of the subscription context.requestId
- Identifier of the subscription request.true
if a SubscribeRequest
has been
sent to the topic.private boolean updateSubscriptionToTopic(AgentId topicId, int contextId, int requestId, boolean asyncSub)
topicId
- Identifier of the topic to subscribe to.contextId
- Identifier of the subscription context.requestId
- Identifier of the subscription request.asyncSub
- asynchronous subscription request.true
if a SubscribeRequest
has been
sent to the topic.public long getNbMsgsSentToDMQSinceCreation()
UserAgentMBean
getNbMsgsSentToDMQSinceCreation
in interface UserAgentMBean
private ProducerMessages processInterceptors(int key, ProducerMessages pm)
private void addInterceptor(String agentId, String agentName, String interceptorsKey, List<MessageInterceptor> interceptors, Properties prop, List<Properties> interceptorsProp) throws Exception
Exception
private void removeInterceptor(String interceptorsKey, List<MessageInterceptor> interceptors, String classNames, List<Properties> interceptorsProp) throws Exception
Exception
private void replaceInterceptorIN(String agentId, String agentName, Properties prop) throws Exception
Exception
private void replaceInterceptorOUT(String agentId, String agentName, Properties prop) throws Exception
Exception
public void modifiedClient(ClientContext cc)
modifiedClient
in interface ProxyAgentItf
public void modifiedSubscription(ClientSubscription cs)
modifiedSubscription
in interface ProxyAgentItf
private void saveModifiedClientContexts()
private void saveModifiedClientSubscriptions()
public int getEncodableClassId()
Agent
getEncodableClassId
in interface Encodable
getEncodableClassId
in class Agent
public int getEncodedSize() throws Exception
Agent
getEncodedSize
in interface Encodable
getEncodedSize
in class Agent
Exception
- if an error occurspublic void encode(Encoder encoder) throws Exception
Agent
Copyright © 2015 ScalAgent D.T.. All Rights Reserved.