public interface ClientSession extends XAResource, AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static interface |
ClientSession.AddressQuery
Information returned by a binding query
|
static interface |
ClientSession.QueueQuery
Information returned by a queue query
|
Modifier and Type | Field and Description |
---|---|
static String |
JMS_SESSION_CLIENT_ID_PROPERTY
Just like
JMS_SESSION_IDENTIFIER_PROPERTY this is
used to identify the ClientID over JMS Session. |
static String |
JMS_SESSION_IDENTIFIER_PROPERTY
This is used to identify a ClientSession as used by the JMS Layer
The JMS Layer will add this through Meta-data, so the server or management layers
can identify session created over core API purely or through the JMS Layer
|
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
Modifier and Type | Method and Description |
---|---|
void |
addFailoverListener(FailoverEventListener listener)
Adds a FailoverEventListener to the session which is notified if a failover event occurs on the session.
|
void |
addFailureListener(SessionFailureListener listener)
Adds a FailureListener to the session which is notified if a failure occurs on the session.
|
void |
addMetaData(String key,
String data)
Attach any metadata to the session.
|
ClientSession.AddressQuery |
addressQuery(SimpleString address)
Queries information on a binding.
|
void |
addUniqueMetaData(String key,
String data)
Attach any metadata to the session.
|
void |
close()
Closes the session.
|
void |
commit()
Commits the current transaction.
|
ClientConsumer |
createConsumer(SimpleString queueName)
Creates a ClientConsumer to consume message from the queue with the given name.
|
ClientConsumer |
createConsumer(SimpleString queueName,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages from the queue with the given name.
|
ClientConsumer |
createConsumer(SimpleString queueName,
SimpleString filter)
Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.
|
ClientConsumer |
createConsumer(SimpleString queueName,
SimpleString filter,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages matching the filter from the queue with
the given name.
|
ClientConsumer |
createConsumer(SimpleString queueName,
SimpleString filter,
int windowSize,
int maxRate,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages matching the filter from the queue with
the given name.
|
ClientConsumer |
createConsumer(String queueName)
Creates a ClientConsumer to consume messages from the queue with the given name.
|
ClientConsumer |
createConsumer(String queueName,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages from the queue with the given name.
|
ClientConsumer |
createConsumer(String queueName,
String filter)
Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.
|
ClientConsumer |
createConsumer(String queueName,
String filter,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages matching the filter from the queue with
the given name.
|
ClientConsumer |
createConsumer(String queueName,
String filter,
int windowSize,
int maxRate,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages matching the filter from the queue with
the given name.
|
ClientMessage |
createMessage(boolean durable)
Creates a ClientMessage.
|
ClientMessage |
createMessage(byte type,
boolean durable)
Creates a ClientMessage.
|
ClientMessage |
createMessage(byte type,
boolean durable,
long expiration,
long timestamp,
byte priority)
Creates a ClientMessage.
|
ClientProducer |
createProducer()
Creates a producer with no default address.
|
ClientProducer |
createProducer(SimpleString address)
Creates a producer which sends messages to the given address
|
ClientProducer |
createProducer(SimpleString address,
int rate)
Creates a producer which sends messages to the given address
|
ClientProducer |
createProducer(String address)
Creates a producer which sends messages to the given address
|
void |
createQueue(SimpleString address,
SimpleString queueName)
Creates a non-temporary queue non-durable queue.
|
void |
createQueue(SimpleString address,
SimpleString queueName,
boolean durable)
Creates a non-temporary queue.
|
void |
createQueue(SimpleString address,
SimpleString queueName,
SimpleString filter,
boolean durable)
Creates a non-temporary queue.
|
void |
createQueue(String address,
String queueName)
Creates a non-temporary queue non-durable queue.
|
void |
createQueue(String address,
String queueName,
boolean durable)
Creates a non-temporary queue.
|
void |
createQueue(String address,
String queueName,
String filter,
boolean durable)
Creates a non-temporaryqueue.
|
void |
createSharedQueue(SimpleString address,
SimpleString queueName,
boolean durable)
Creates a transient queue.
|
void |
createSharedQueue(SimpleString address,
SimpleString queueName,
SimpleString filter,
boolean durable)
Creates a transient queue.
|
void |
createTemporaryQueue(SimpleString address,
SimpleString queueName)
Creates a temporary queue.
|
void |
createTemporaryQueue(SimpleString address,
SimpleString queueName,
SimpleString filter)
Creates a temporary queue with a filter.
|
void |
createTemporaryQueue(String address,
String queueName)
Creates a temporary queue.
|
void |
createTemporaryQueue(String address,
String queueName,
String filter)
Creates a temporary queue with a filter.
|
void |
deleteQueue(SimpleString queueName)
Deletes the queue.
|
void |
deleteQueue(String queueName)
Deletes the queue.
|
ClientSessionFactory |
getSessionFactory()
Return the sessionFactory used to created this Session.
|
int |
getVersion()
Returns the server's incrementingVersion.
|
XAResource |
getXAResource()
Returns the XAResource associated to the session.
|
boolean |
isAutoCommitAcks()
Returns whether the session will automatically commit its transaction every time a message is acknowledged
by a ClientConsumer created by this session,
false else |
boolean |
isAutoCommitSends()
Returns whether the session will automatically commit its transaction every time a message is sent
by a ClientProducer created by this session,
false else |
boolean |
isBlockOnAcknowledge()
Returns whether the ClientConsumer created by the session will block when they acknowledge a message.
|
boolean |
isClosed()
Returns whether the session is closed or not.
|
boolean |
isRollbackOnly()
Returns
true if the current transaction has been flagged to rollback, false else. |
boolean |
isXA()
Return
true if the session supports XA, false else. |
ClientSession.QueueQuery |
queueQuery(SimpleString queueName)
Queries information on a queue.
|
boolean |
removeFailoverListener(FailoverEventListener listener)
Removes a FailoverEventListener to the session.
|
boolean |
removeFailureListener(SessionFailureListener listener)
Removes a FailureListener to the session.
|
void |
rollback()
Rolls back the current transaction.
|
void |
rollback(boolean considerLastMessageAsDelivered)
Rolls back the current transaction.
|
ClientSession |
setSendAcknowledgementHandler(SendAcknowledgementHandler handler)
Sets a
SendAcknowledgementHandler for this session. |
ClientSession |
start()
Starts the session.
|
void |
stop()
Stops the session.
|
commit, end, forget, getTransactionTimeout, isSameRM, prepare, recover, rollback, setTransactionTimeout, start
static final String JMS_SESSION_IDENTIFIER_PROPERTY
static final String JMS_SESSION_CLIENT_ID_PROPERTY
JMS_SESSION_IDENTIFIER_PROPERTY
this is
used to identify the ClientID over JMS Session.
However this is only used when the JMS Session.clientID is set (which is optional).
With this property management tools and the server can identify the jms-client-id used over JMSClientSession start() throws ActiveMQException
ActiveMQException
- if an exception occurs while starting the sessionvoid stop() throws ActiveMQException
ActiveMQException
- if an exception occurs while stopping the sessionvoid close() throws ActiveMQException
close
in interface AutoCloseable
ActiveMQException
- if an exception occurs while closing the sessionboolean isClosed()
true
if the session is closed, false
elsevoid addFailureListener(SessionFailureListener listener)
listener
- the listener to addboolean removeFailureListener(SessionFailureListener listener)
listener
- the listener to removetrue
if the listener was removed, false
elsevoid addFailoverListener(FailoverEventListener listener)
listener
- the listener to addboolean removeFailoverListener(FailoverEventListener listener)
listener
- the listener to removetrue
if the listener was removed, false
elseint getVersion()
incrementingVersion
void createQueue(SimpleString address, SimpleString queueName, boolean durable) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- whether the queue is durable or notActiveMQException
- in an exception occurs while creating the queuevoid createSharedQueue(SimpleString address, SimpleString queueName, boolean durable) throws ActiveMQException
Notice: you will get an exception if the address or the filter doesn't match to an already existent queue
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- if the queue is durableActiveMQException
- in an exception occurs while creating the queuevoid createSharedQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable) throws ActiveMQException
Notice: you will get an exception if the address or the filter doesn't match to an already existent queue
address
- the queue will be bound to this addressqueueName
- the name of the queuefilter
- whether the queue is durable or notdurable
- if the queue is durableActiveMQException
- in an exception occurs while creating the queuevoid createQueue(String address, String queueName, boolean durable) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- whether the queue is durable or notActiveMQException
- in an exception occurs while creating the queuevoid createQueue(String address, String queueName) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queueActiveMQException
- in an exception occurs while creating the queuevoid createQueue(SimpleString address, SimpleString queueName) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queueActiveMQException
- in an exception occurs while creating the queuevoid createQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queuefilter
- only messages which match this filter will be put in the queuedurable
- whether the queue is durable or notActiveMQException
- in an exception occurs while creating the queuevoid createQueue(String address, String queueName, String filter, boolean durable) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- whether the queue is durable or notfilter
- only messages which match this filter will be put in the queueActiveMQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(SimpleString address, SimpleString queueName) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queueActiveMQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(String address, String queueName) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queueActiveMQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(SimpleString address, SimpleString queueName, SimpleString filter) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queuefilter
- only messages which match this filter will be put in the queueActiveMQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(String address, String queueName, String filter) throws ActiveMQException
address
- the queue will be bound to this addressqueueName
- the name of the queuefilter
- only messages which match this filter will be put in the queueActiveMQException
- in an exception occurs while creating the queuevoid deleteQueue(SimpleString queueName) throws ActiveMQException
queueName
- the name of the queue to deleteActiveMQException
- if there is no queue for the given name or if the queue has consumersvoid deleteQueue(String queueName) throws ActiveMQException
queueName
- the name of the queue to deleteActiveMQException
- if there is no queue for the given name or if the queue has consumersClientConsumer createConsumer(SimpleString queueName) throws ActiveMQException
queueName
- name of the queue to consume messages fromActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName) throws ActiveMQException
queueName
- name of the queue to consume messages fromActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(SimpleString queueName, SimpleString filter) throws ActiveMQException
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, String filter) throws ActiveMQException
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(SimpleString queueName, boolean browseOnly) throws ActiveMQException
If browseOnly
is true
, the ClientConsumer will receive the messages
from the queue but they will not be consumed (the messages will remain in the queue). Note
that paged messages will not be in the queue, and will therefore not be visible if
browseOnly
is true
.
If browseOnly
is false
, the ClientConsumer will behave like consume
the messages from the queue and the messages will effectively be removed from the queue.
queueName
- name of the queue to consume messages frombrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.ActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, boolean browseOnly) throws ActiveMQException
If browseOnly
is true
, the ClientConsumer will receive the messages
from the queue but they will not be consumed (the messages will remain in the queue). Note
that paged messages will not be in the queue, and will therefore not be visible if
browseOnly
is true
.
If browseOnly
is false
, the ClientConsumer will behave like consume
the messages from the queue and the messages will effectively be removed from the queue.
queueName
- name of the queue to consume messages frombrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.ActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, String filter, boolean browseOnly) throws ActiveMQException
If browseOnly
is true
, the ClientConsumer will receive the messages
from the queue but they will not be consumed (the messages will remain in the queue). Note
that paged messages will not be in the queue, and will therefore not be visible if
browseOnly
is true
.
If browseOnly
is false
, the ClientConsumer will behave like consume
the messages from the queue and the messages will effectively be removed from the queue.
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedbrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.ActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(SimpleString queueName, SimpleString filter, boolean browseOnly) throws ActiveMQException
If browseOnly
is true
, the ClientConsumer will receive the messages
from the queue but they will not be consumed (the messages will remain in the queue). Note
that paged messages will not be in the queue, and will therefore not be visible if
browseOnly
is true
.
If browseOnly
is false
, the ClientConsumer will behave like consume
the messages from the queue and the messages will effectively be removed from the queue.
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedbrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.ActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(SimpleString queueName, SimpleString filter, int windowSize, int maxRate, boolean browseOnly) throws ActiveMQException
If browseOnly
is true
, the ClientConsumer will receive the messages
from the queue but they will not be consumed (the messages will remain in the queue). Note
that paged messages will not be in the queue, and will therefore not be visible if
browseOnly
is true
.
If browseOnly
is false
, the ClientConsumer will behave like consume
the messages from the queue and the messages will effectively be removed from the queue.
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedwindowSize
- the consumer window sizemaxRate
- the maximum rate to consume messagesbrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.ActiveMQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, String filter, int windowSize, int maxRate, boolean browseOnly) throws ActiveMQException
If browseOnly
is true
, the ClientConsumer will receive the messages
from the queue but they will not be consumed (the messages will remain in the queue). Note
that paged messages will not be in the queue, and will therefore not be visible if
browseOnly
is true
.
If browseOnly
is false
, the ClientConsumer will behave like consume
the messages from the queue and the messages will effectively be removed from the queue.
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedwindowSize
- the consumer window sizemaxRate
- the maximum rate to consume messagesbrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.ActiveMQException
- if an exception occurs while creating the ClientConsumerClientProducer createProducer() throws ActiveMQException
ActiveMQException
ClientProducer.send(SimpleString, org.apache.activemq.artemis.api.core.Message)
ClientProducer createProducer(SimpleString address) throws ActiveMQException
address
- the address to send messages toActiveMQException
- if an exception occurs while creating the ClientProducerClientProducer createProducer(String address) throws ActiveMQException
address
- the address to send messages toActiveMQException
- if an exception occurs while creating the ClientProducerClientProducer createProducer(SimpleString address, int rate) throws ActiveMQException
address
- the address to send messages torate
- the producer rateActiveMQException
- if an exception occurs while creating the ClientProducerClientMessage createMessage(boolean durable)
durable
- whether the created message is durable or notClientMessage createMessage(byte type, boolean durable)
type
- type of the messagedurable
- whether the created message is durable or notClientMessage createMessage(byte type, boolean durable, long expiration, long timestamp, byte priority)
type
- type of the messagedurable
- whether the created message is durable or notexpiration
- the message expirationtimestamp
- the message timestamppriority
- the message priority (between 0 and 9 inclusive)ClientSession.QueueQuery queueQuery(SimpleString queueName) throws ActiveMQException
queueName
- the name of the queue to queryActiveMQException
- if an exception occurs while querying the queueClientSession.AddressQuery addressQuery(SimpleString address) throws ActiveMQException
address
- the address of the biding to queryActiveMQException
- if an exception occurs while querying the bindingXAResource getXAResource()
boolean isXA()
true
if the session supports XA, false
else.true
if the session supports XA, false
else.void commit() throws ActiveMQException
ActiveMQException
- if an exception occurs while committing the transactionvoid rollback() throws ActiveMQException
ActiveMQException
- if an exception occurs while rolling back the transactionvoid rollback(boolean considerLastMessageAsDelivered) throws ActiveMQException
considerLastMessageAsDelivered
- the first message on deliveringMessage Buffer is considered as deliveredActiveMQException
- if an exception occurs while rolling back the transactionboolean isRollbackOnly()
true
if the current transaction has been flagged to rollback, false
else.true
if the current transaction has been flagged to rollback, false
else.boolean isAutoCommitSends()
false
elsetrue
if the session automatically commit its transaction every time a message is sent, false
elseboolean isAutoCommitAcks()
false
elsetrue
if the session automatically commit its transaction every time a message is acknowledged, false
elseboolean isBlockOnAcknowledge()
true
if the session's ClientConsumer block when they acknowledge a message, false
elseClientSession setSendAcknowledgementHandler(SendAcknowledgementHandler handler)
SendAcknowledgementHandler
for this session.handler
- a SendAcknowledgementHandlervoid addMetaData(String key, String data) throws ActiveMQException
ActiveMQException
void addUniqueMetaData(String key, String data) throws ActiveMQException
ActiveMQException
ClientSessionFactory getSessionFactory()
Copyright © 2016 JBoss by Red Hat. All rights reserved.