public interface ClientSession extends XAResource, AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static interface |
ClientSession.BindingQuery
Information returned by a binding query
|
static interface |
ClientSession.QueueQuery
Information returned by a queue query
|
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.
|
void |
addUniqueMetaData(String key,
String data)
Attach any metadata to the session.
|
ClientSession.BindingQuery |
bindingQuery(org.hornetq.api.core.SimpleString address)
Queries information on a binding.
|
void |
close()
Closes the session.
|
void |
commit()
Commits the current transaction.
|
ClientConsumer |
createConsumer(org.hornetq.api.core.SimpleString queueName)
Creates a ClientConsumer to consume message from the queue with the given name.
|
ClientConsumer |
createConsumer(org.hornetq.api.core.SimpleString queueName,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages from the queue with the given name.
|
ClientConsumer |
createConsumer(org.hornetq.api.core.SimpleString queueName,
org.hornetq.api.core.SimpleString filter)
Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.
|
ClientConsumer |
createConsumer(org.hornetq.api.core.SimpleString queueName,
org.hornetq.api.core.SimpleString filter,
boolean browseOnly)
Creates a ClientConsumer to consume or browse messages matching the filter from the queue with
the given name.
|
ClientConsumer |
createConsumer(org.hornetq.api.core.SimpleString queueName,
org.hornetq.api.core.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(org.hornetq.api.core.SimpleString address)
Creates a producer which sends messages to the given address
|
ClientProducer |
createProducer(org.hornetq.api.core.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(org.hornetq.api.core.SimpleString address,
org.hornetq.api.core.SimpleString queueName)
Creates a non-temporary queue non-durable queue.
|
void |
createQueue(org.hornetq.api.core.SimpleString address,
org.hornetq.api.core.SimpleString queueName,
boolean durable)
Creates a non-temporary queue.
|
void |
createQueue(org.hornetq.api.core.SimpleString address,
org.hornetq.api.core.SimpleString queueName,
org.hornetq.api.core.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(org.hornetq.api.core.SimpleString address,
org.hornetq.api.core.SimpleString queueName,
boolean durable)
Creates a transient queue.
|
void |
createSharedQueue(org.hornetq.api.core.SimpleString address,
org.hornetq.api.core.SimpleString queueName,
org.hornetq.api.core.SimpleString filter,
boolean durable)
Creates a transient queue.
|
void |
createTemporaryQueue(org.hornetq.api.core.SimpleString address,
org.hornetq.api.core.SimpleString queueName)
Creates a temporary queue.
|
void |
createTemporaryQueue(org.hornetq.api.core.SimpleString address,
org.hornetq.api.core.SimpleString queueName,
org.hornetq.api.core.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(org.hornetq.api.core.SimpleString queueName)
Deletes the queue.
|
void |
deleteQueue(String queueName)
Deletes the queue.
|
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(org.hornetq.api.core.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.
|
void |
setSendAcknowledgementHandler(SendAcknowledgementHandler handler)
Sets a
SendAcknowledgementHandler for this session. |
void |
start()
Starts the session.
|
void |
stop()
Stops the session.
|
commit, end, forget, getTransactionTimeout, isSameRM, prepare, recover, rollback, setTransactionTimeout, start
void start() throws org.hornetq.api.core.HornetQException
org.hornetq.api.core.HornetQException
- if an exception occurs while starting the sessionvoid stop() throws org.hornetq.api.core.HornetQException
org.hornetq.api.core.HornetQException
- if an exception occurs while stopping the sessionvoid close() throws org.hornetq.api.core.HornetQException
close
in interface AutoCloseable
org.hornetq.api.core.HornetQException
- 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(org.hornetq.api.core.SimpleString address, org.hornetq.api.core.SimpleString queueName, boolean durable) throws org.hornetq.api.core.HornetQException
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- whether the queue is durable or notorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createSharedQueue(org.hornetq.api.core.SimpleString address, org.hornetq.api.core.SimpleString queueName, boolean durable) throws org.hornetq.api.core.HornetQException
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- if the queue is durableorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createSharedQueue(org.hornetq.api.core.SimpleString address, org.hornetq.api.core.SimpleString queueName, org.hornetq.api.core.SimpleString filter, boolean durable) throws org.hornetq.api.core.HornetQException
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 durableorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createQueue(String address, String queueName, boolean durable) throws org.hornetq.api.core.HornetQException
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- whether the queue is durable or notorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createQueue(String address, String queueName) throws org.hornetq.api.core.HornetQException
address
- the queue will be bound to this addressqueueName
- the name of the queueorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createQueue(org.hornetq.api.core.SimpleString address, org.hornetq.api.core.SimpleString queueName) throws org.hornetq.api.core.HornetQException
address
- the queue will be bound to this addressqueueName
- the name of the queueorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createQueue(org.hornetq.api.core.SimpleString address, org.hornetq.api.core.SimpleString queueName, org.hornetq.api.core.SimpleString filter, boolean durable) throws org.hornetq.api.core.HornetQException
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 notorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createQueue(String address, String queueName, String filter, boolean durable) throws org.hornetq.api.core.HornetQException
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 queueorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(org.hornetq.api.core.SimpleString address, org.hornetq.api.core.SimpleString queueName) throws org.hornetq.api.core.HornetQException
address
- the queue will be bound to this addressqueueName
- the name of the queueorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(String address, String queueName) throws org.hornetq.api.core.HornetQException
address
- the queue will be bound to this addressqueueName
- the name of the queueorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(org.hornetq.api.core.SimpleString address, org.hornetq.api.core.SimpleString queueName, org.hornetq.api.core.SimpleString filter) throws org.hornetq.api.core.HornetQException
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 queueorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid createTemporaryQueue(String address, String queueName, String filter) throws org.hornetq.api.core.HornetQException
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 queueorg.hornetq.api.core.HornetQException
- in an exception occurs while creating the queuevoid deleteQueue(org.hornetq.api.core.SimpleString queueName) throws org.hornetq.api.core.HornetQException
queueName
- the name of the queue to deleteorg.hornetq.api.core.HornetQException
- if there is no queue for the given name or if the queue has consumersvoid deleteQueue(String queueName) throws org.hornetq.api.core.HornetQException
queueName
- the name of the queue to deleteorg.hornetq.api.core.HornetQException
- if there is no queue for the given name or if the queue has consumersClientConsumer createConsumer(org.hornetq.api.core.SimpleString queueName) throws org.hornetq.api.core.HornetQException
queueName
- name of the queue to consume messages fromorg.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName) throws org.hornetq.api.core.HornetQException
queueName
- name of the queue to consume messages fromorg.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(org.hornetq.api.core.SimpleString queueName, org.hornetq.api.core.SimpleString filter) throws org.hornetq.api.core.HornetQException
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedorg.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, String filter) throws org.hornetq.api.core.HornetQException
queueName
- name of the queue to consume messages fromfilter
- only messages which match this filter will be consumedorg.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(org.hornetq.api.core.SimpleString queueName, boolean browseOnly) throws org.hornetq.api.core.HornetQException
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.org.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, boolean browseOnly) throws org.hornetq.api.core.HornetQException
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.org.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, String filter, boolean browseOnly) throws org.hornetq.api.core.HornetQException
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.org.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(org.hornetq.api.core.SimpleString queueName, org.hornetq.api.core.SimpleString filter, boolean browseOnly) throws org.hornetq.api.core.HornetQException
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.org.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(org.hornetq.api.core.SimpleString queueName, org.hornetq.api.core.SimpleString filter, int windowSize, int maxRate, boolean browseOnly) throws org.hornetq.api.core.HornetQException
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.org.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientConsumer createConsumer(String queueName, String filter, int windowSize, int maxRate, boolean browseOnly) throws org.hornetq.api.core.HornetQException
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.org.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientConsumerClientProducer createProducer() throws org.hornetq.api.core.HornetQException
org.hornetq.api.core.HornetQException
ClientProducer.send(SimpleString, org.hornetq.api.core.Message)
ClientProducer createProducer(org.hornetq.api.core.SimpleString address) throws org.hornetq.api.core.HornetQException
address
- the address to send messages toorg.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientProducerClientProducer createProducer(String address) throws org.hornetq.api.core.HornetQException
address
- the address to send messages toorg.hornetq.api.core.HornetQException
- if an exception occurs while creating the ClientProducerClientProducer createProducer(org.hornetq.api.core.SimpleString address, int rate) throws org.hornetq.api.core.HornetQException
address
- the address to send messages torate
- the producer rateorg.hornetq.api.core.HornetQException
- 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(org.hornetq.api.core.SimpleString queueName) throws org.hornetq.api.core.HornetQException
queueName
- the name of the queue to queryorg.hornetq.api.core.HornetQException
- if an exception occurs while querying the queueClientSession.BindingQuery bindingQuery(org.hornetq.api.core.SimpleString address) throws org.hornetq.api.core.HornetQException
address
- the address of the biding to queryorg.hornetq.api.core.HornetQException
- 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 org.hornetq.api.core.HornetQException
org.hornetq.api.core.HornetQException
- if an exception occurs while committing the transactionvoid rollback() throws org.hornetq.api.core.HornetQException
org.hornetq.api.core.HornetQException
- if an exception occurs while rolling back the transactionvoid rollback(boolean considerLastMessageAsDelivered) throws org.hornetq.api.core.HornetQException
considerLastMessageAsDelivered
- the first message on deliveringMessage Buffer is considered as deliveredorg.hornetq.api.core.HornetQException
- 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
elsevoid setSendAcknowledgementHandler(SendAcknowledgementHandler handler)
SendAcknowledgementHandler
for this session.handler
- a SendAcknowledgementHandlervoid addMetaData(String key, String data) throws org.hornetq.api.core.HornetQException
org.hornetq.api.core.HornetQException
void addUniqueMetaData(String key, String data) throws org.hornetq.api.core.HornetQException
org.hornetq.api.core.HornetQException
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.