|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.server.JmsServerSession
A session represents a server side endpoint to the JMSServer. A client can create producers, consumers and destinations through the session in addi- tion to other functions. A session has a unique identifer which is a comb- ination of clientId-connectionId-sessionId.
A session represents a single-threaded context which implies that it cannot be used with more than one thread concurrently. Threads registered with this session are synchronized.
Finally, instances of this object can only be created by classes within the same package.
JmsServerConnection
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Method Summary | |
void |
acknowledgeMessage(long clientId,
java.lang.String id)
Acknowledge that the message with the following id has been processed |
void |
close()
Close and release any resource allocated to this session. |
void |
commit()
Commit this session, which will acknowledge all sent messages for all consumers. |
void |
commit(javax.transaction.xa.Xid xid,
boolean onePhase)
|
boolean |
containsUnackedHandle(MessageHandle handle)
Check if the specified message handle is in the session's list of unacked messages |
void |
createBrowser(JmsQueue queue,
long clientId,
java.lang.String selector)
Create a queue browser for this session. |
void |
createPublisher(JmsTopic topic)
This should be a no operation. |
void |
createQueue(JmsQueue queue)
Create an amdinistered queue, through the message manager admin interface. |
void |
createReceiver(JmsQueue queue,
long clientId,
java.lang.String selector)
Create a receiver endpoint for this session. |
void |
createSender(JmsQueue queue)
This is a no-op |
void |
createSubscriber(JmsTopic topic,
java.lang.String name,
long clientId,
java.lang.String selector,
boolean noLocal)
Create a subscriber endpoint for this session. |
void |
createTopic(JmsTopic topic)
Create an administered topic, through the message manager admin interface. |
void |
deleteBrowser(long clientId)
Delete the queue browser associated with the specified queue from the session. |
void |
deletePublisher(JmsTopic topic)
Delete the publisher associated with the specified topic from the session. |
void |
deleteReceiver(long clientId)
Delete the receiver with the specified identity and clean up all associated resources. |
void |
deleteSender(long clientId)
Delete the sender associated with the specified queue from the session If the corresponding sender does not exist or it cannot delete it then throw the JMSException. |
void |
deleteSubscriber(long clientId)
This function deletes a persistent subsrciber and its history from the database. |
void |
enableAsynchronousDelivery(long clientId,
java.lang.String id,
boolean enable)
Check whether to enable asynchronous message delivery for a particular consumer |
void |
end(javax.transaction.xa.Xid xid,
int flags)
|
void |
forget(javax.transaction.xa.Xid xid)
|
int |
getAckMode()
Returns the message acknowledgement mode for the session |
java.lang.String |
getClientId()
Return a reference to the client id |
ConsumerEndpoint |
getConsumerEndpoint(long clientId)
Returns the consumer endpoint for the supplied client id |
java.lang.String |
getResourceManagerId()
Return the identity of the ResourceManager . |
java.lang.String |
getSessionId()
Return a reference to the session id |
int |
getTransactionTimeout()
|
javax.transaction.xa.Xid |
getXid()
Return the xid that is currently associated with this session or null if this session is currently not part of a global transactions |
boolean |
isClientEndpointActive()
This will send a null message down the connection to the client to test whether the client endpoint is alive. |
boolean |
isSameRM(javax.transaction.xa.XAResource xares)
|
boolean |
isTransacted()
Determines if the session is transacted |
void |
onMessage(MessageHandle handle,
boolean ignore)
Send the specified message to the client. |
void |
onMessageAvailable(long clientId)
Inform the session that there is a message available for the message consumer with the specified identity |
void |
onMessages(java.util.Vector handles)
Send the specified collection of messages to the client |
int |
prepare(javax.transaction.xa.Xid xid)
|
javax.jms.Message |
receiveMessage(long clientId,
long wait)
Return the next message for the specified client. |
java.util.Vector |
receiveMessages(long clientId,
int count)
Return up to count messages from the endpoint with the specified client identity. |
void |
recover()
Call recover on all registered consumers. |
javax.transaction.xa.Xid[] |
recover(int flag)
|
void |
rollback()
Abort, will return all unacked messages to their respective endpoints, if they are still active. |
void |
rollback(javax.transaction.xa.Xid xid)
|
void |
sendMessage(javax.jms.Message message)
Send the specified message to the server |
void |
sendMessages(java.util.Vector messages)
Send the specified messages to the server. |
void |
setMessageListener(JmsMessageListener listener)
Set a message listener for the session. |
boolean |
setTransactionTimeout(int seconds)
|
void |
start()
Start the message delivery for the session. |
void |
start(javax.transaction.xa.Xid xid,
int flags)
|
void |
startMessageDelivery()
Start message delivery to this session. |
void |
stop()
Stop message delivery for the session |
void |
stopMessageDelivery()
Stop message delivery to this session. |
void |
unsubscribe(java.lang.String name)
Unsubscribe a durable subscription. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public java.lang.String getClientId()
public java.lang.String getSessionId()
public void start()
public void stop()
public void close() throws javax.jms.JMSException
javax.jms.JMSException
- if the session cannot be closedpublic void acknowledgeMessage(long clientId, java.lang.String id) throws javax.jms.JMSException
clientId
- the clientId that sent the message to the clientid
- the message to ackjavax.jms.JMSException
- if message cannot be acknowledgedpublic void sendMessage(javax.jms.Message message) throws javax.jms.JMSException
message
- the message to sendjavax.jms.JMSException
- if the message can't be sentpublic void sendMessages(java.util.Vector messages) throws javax.jms.JMSException
messages
- the messages to sendjavax.jms.JMSException
- if the messages can't be sentpublic javax.jms.Message receiveMessage(long clientId, long wait) throws javax.jms.JMSException
wait
parameter indicates how long many milliseconds to wait for a message
before returning. If wait
is 0 then do not wait at all. If
wait
is -1 then wait indefinitely for the next messageclientId
- the client identitywait
- number of ms to waitnull
if there is no messagejavax.jms.JMSException
- if the message can't be receivedpublic java.util.Vector receiveMessages(long clientId, int count) throws javax.jms.JMSException
clientId
- the client identitycount
- the maximum number of messages retrievejavax.jms.JMSException
- if the endpoint does not exist, or is not a
QueueBrowserEndpoint
public void createQueue(JmsQueue queue) throws javax.jms.JMSException
queue
- administered queue to createjavax.jms.JMSException
- if the queue can't be createdpublic void createTopic(JmsTopic topic) throws javax.jms.JMSException
topic
- administered topic to createjavax.jms.JMSException
- if the topic can't be createdpublic void createReceiver(JmsQueue queue, long clientId, java.lang.String selector) throws javax.jms.JMSException
You cannot create more than one receiver for the same destination
queue
- the receiver destinationconsumerId
- the client session allocated identifier of the
consumerselector
- the selector to filter messages. May be
null
javax.jms.JMSException
- if the receiver can't be createdpublic void createSender(JmsQueue queue) throws javax.jms.JMSException
public void createBrowser(JmsQueue queue, long clientId, java.lang.String selector) throws javax.jms.JMSException
You cannot create more than one queue browser for the same queue in a single session.
queue
- queue to browseclientId
- the client identityselector
- message selector. This may be nullJMSException.
- public void deleteReceiver(long clientId) throws javax.jms.JMSException
clientId
- the identity of the receiverjavax.jms.JMSException
- if the receiver cannot be deletedpublic void deleteSender(long clientId) throws javax.jms.JMSException
clientId
- the identity of the senderjavax.jms.JMSException
- if the sender cannot be deletedpublic void deleteBrowser(long clientId) throws javax.jms.JMSException
clientId
- the identity of the browserjavax.jms.JMSException
- if the browser cannot be deletedpublic void createSubscriber(JmsTopic topic, java.lang.String name, long clientId, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
Note that the message manager manages consumers for all server sessions
You cannot create more than one subscriber for the same destination. Currently we don't check this
topic
- subscriber destinationname
- consumer nameclientId
- the client session allocated
identifier of the consumerselector
- the selector to filter messages.
This may be null.noLocal
- true to inhibit consumption of messages
published on this connection.JMSException.
- public void createPublisher(JmsTopic topic) throws javax.jms.JMSException
topic
- receiver destinationJMSException.
- public void deleteSubscriber(long clientId) throws javax.jms.JMSException
The data contains information necessary to delete the subscriber
clientId
- the client identityJMSException.
- public void deletePublisher(JmsTopic topic) throws javax.jms.JMSException
topic
- sender destinationJMSException.
- public void unsubscribe(java.lang.String name) throws javax.jms.JMSException
name
- the name used to uniquely identify the
subscriptionjavax.jms.JMSException
- if the subscription cannot be removed
or any other problem.public void stopMessageDelivery() throws javax.jms.JMSException
javax.jms.JMSException
- public void startMessageDelivery() throws javax.jms.JMSException
javax.jms.JMSException
- public boolean containsUnackedHandle(MessageHandle handle)
handle
- - the handle to querypublic void onMessage(MessageHandle handle, boolean ignore) throws java.lang.Exception
InternalMessageListener
onMessage
in interface InternalMessageListener
org.exolab.jms.messagemgr.InternalMessageListener
message
- - message handleack
- - false ignores the acking policyjava.lang.Exception
- - propagate exceptions to clientpublic void onMessages(java.util.Vector handles) throws java.lang.Exception
InternalMessageListener
onMessages
in interface InternalMessageListener
org.exolab.jms.messagemgr.InternalMessageListener
messages
- - collection of MessageHandle objectsjava.lang.Exception
- - propagate exceptions to clientpublic void onMessageAvailable(long clientId) throws java.lang.Exception
InternalMessageListener
onMessageAvailable
in interface InternalMessageListener
org.exolab.jms.messagemgr.InternalMessageListener
clientId
- - the identity of the clientpublic boolean isClientEndpointActive()
true
if it is active, otherwise false
public void setMessageListener(JmsMessageListener listener)
listener
- the message listenerpublic void enableAsynchronousDelivery(long clientId, java.lang.String id, boolean enable) throws javax.jms.JMSException
clientId
- the id of the client to checkid
- the last processed messageenable
- true
to enable; false
to disablepublic void recover() throws javax.jms.JMSException
javax.jms.JMSException
- if the session can't be recoveredpublic void commit() throws javax.jms.JMSException
javax.jms.JMSException
- - if there are any problemspublic void rollback() throws javax.jms.JMSException
javax.jms.JMSException
- - if there are any problemspublic void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
public void end(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
public int getTransactionTimeout() throws javax.transaction.xa.XAException
getTransactionTimeout
in interface javax.transaction.xa.XAResource
public boolean isSameRM(javax.transaction.xa.XAResource xares) throws javax.transaction.xa.XAException
isSameRM
in interface javax.transaction.xa.XAResource
public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
public javax.transaction.xa.Xid[] recover(int flag) throws javax.transaction.xa.XAException
recover
in interface javax.transaction.xa.XAResource
public void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
public boolean setTransactionTimeout(int seconds) throws javax.transaction.xa.XAException
setTransactionTimeout
in interface javax.transaction.xa.XAResource
public void start(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
public javax.transaction.xa.Xid getXid()
public java.lang.String getResourceManagerId() throws javax.transaction.xa.XAException
ResourceManager
. The transaction
manager should be the only one to initiating this call.javax.transaction.xa.XAException
- - if it cannot retrieve the rid.public boolean isTransacted()
true
if the session is transactedpublic int getAckMode()
public ConsumerEndpoint getConsumerEndpoint(long clientId)
clientId
- the identity of the consumer endpointclientId
,
or null
if none exists
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |