public class ClientSessionImpl extends Object implements ClientSessionInternal, FailureListener, CommandConfirmationHandler
ClientSession.BindingQuery, ClientSession.QueueQuery
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
Constructor and Description |
---|
ClientSessionImpl(ClientSessionFactoryInternal sessionFactory,
String name,
String username,
String password,
boolean xa,
boolean autoCommitSends,
boolean autoCommitAcks,
boolean preAcknowledge,
boolean blockOnAcknowledge,
boolean autoGroup,
int ackBatchSize,
int consumerWindowSize,
int consumerMaxRate,
int confirmationWindowSize,
int producerWindowSize,
int producerMaxRate,
boolean blockOnNonDurableSend,
boolean blockOnDurableSend,
boolean cacheLargeMessageClient,
int minLargeMessageSize,
boolean compressLargeMessages,
int initialMessagePacketSize,
String groupID,
CoreRemotingConnection remotingConnection,
int version,
Channel channel,
Executor executor,
Executor flowControlExecutor) |
Modifier and Type | Method and Description |
---|---|
void |
acknowledge(long consumerID,
long messageID) |
void |
addConsumer(ClientConsumerInternal consumer) |
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 |
addMetaDataV1(String key,
String data)
Attach any metadata to the session.
|
void |
addProducer(ClientProducerInternal producer) |
void |
addUniqueMetaData(String key,
String data)
Attach any metadata to the session.
|
ClientSession.BindingQuery |
bindingQuery(SimpleString address)
Queries information on a binding.
|
void |
cleanUp(boolean failingOver) |
void |
close()
Closes the session.
|
void |
commandConfirmed(Packet packet)
called by channel after a confirmation has been received.
|
void |
commit()
Commits the current transaction.
|
void |
commit(Xid xid,
boolean onePhase)
Commit the work done on this resource in the given transaction.
|
void |
connectionFailed(HornetQException me,
boolean failedOver)
Notifies that a connection has failed due to the specified exception.
|
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 filterString)
Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.
|
ClientConsumer |
createConsumer(SimpleString queueName,
SimpleString filterString,
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 filterString,
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 filterString)
Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.
|
ClientConsumer |
createConsumer(String queueName,
String filterString,
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 filterString,
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 maxRate)
Creates a producer which sends messages to the given address
|
ClientProducer |
createProducer(String address)
Creates a producer which sends messages to the given address
|
ClientProducer |
createProducer(String address,
int rate) |
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 filterString,
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 filterString,
boolean durable)
Creates a non-temporaryqueue.
|
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.
|
void |
end(Xid xid,
int flags)
Called to disassociate the resource from a transaction.
|
void |
expire(long consumerID,
long messageID) |
void |
forceDelivery(long consumerID,
long sequence) |
void |
forget(Xid xid)
Tells the resource manager to forget about a heuristic decision.
|
Channel |
getChannel() |
RemotingConnection |
getConnection() |
ClientProducerCredits |
getCredits(SimpleString address,
boolean anon) |
int |
getMinLargeMessageSize() |
String |
getName() |
ClientProducerCreditManager |
getProducerCreditManager() |
ClientSessionFactoryInternal |
getSessionFactory() |
int |
getTransactionTimeout()
Get the current transaction timeout value for this resource.
|
int |
getVersion()
Returns the server's incrementingVersion.
|
XAResource |
getXAResource()
Returns the XAResource associated to the session.
|
void |
handleFailover(CoreRemotingConnection backupConnection) |
void |
handleReceiveContinuation(long consumerID,
SessionReceiveContinuationMessage continuation) |
void |
handleReceiveLargeMessage(long consumerID,
SessionReceiveLargeMessage message) |
void |
handleReceiveMessage(long consumerID,
SessionReceiveMessage message) |
void |
handleReceiveProducerCredits(SimpleString address,
int credits) |
void |
individualAcknowledge(long consumerID,
long messageID) |
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 |
isCacheLargeMessageClient() |
boolean |
isClosed()
Returns whether the session is closed or not.
|
boolean |
isCompressLargeMessages() |
boolean |
isRollbackOnly()
Returns
true if the current transaction has been flagged to rollback, false else. |
boolean |
isSameRM(XAResource xares)
Tells the caller if this resource has the same resource manager
as the argument resource.
|
boolean |
isXA()
Return
true if the session supports XA, false else. |
void |
preHandleFailover(CoreRemotingConnection connection) |
int |
prepare(Xid xid)
Prepare to commit the work done on this resource in the given
transaction.
|
ClientSession.QueueQuery |
queueQuery(SimpleString queueName)
Queries information on a queue.
|
Xid[] |
recover(int flags)
Return a list of transactions that are in a prepared or heuristically
state.
|
void |
removeConsumer(ClientConsumerInternal consumer) |
boolean |
removeFailureListener(SessionFailureListener listener)
Removes a FailureListener to the session.
|
void |
removeProducer(ClientProducerInternal producer) |
void |
resetIfNeeded() |
void |
returnBlocking() |
void |
returnCredits(SimpleString address) |
void |
rollback()
Rolls back the current transaction.
|
void |
rollback(boolean isLastMessageAsDelivered)
Rolls back the current transaction.
|
void |
rollback(Xid xid)
Roll back the work done on this resource in the given transaction.
|
void |
sendProducerCreditsMessage(int credits,
SimpleString address) |
void |
setAddress(Message message,
SimpleString address) |
void |
setForceNotSameRM(boolean force) |
void |
setPacketSize(int packetSize) |
void |
setSendAcknowledgementHandler(SendAcknowledgementHandler handler)
Sets a
SendAcknowledgementHandler for this session. |
boolean |
setTransactionTimeout(int seconds)
Set the transaction timeout value for this resource.
|
void |
start()
Starts the session.
|
void |
start(Xid xid,
int flags)
Called to associate the resource with a transaction.
|
void |
stop()
Stops the session.
|
void |
stop(boolean waitForOnMessage) |
String |
toString() |
void |
workDone() |
public ClientSessionImpl(ClientSessionFactoryInternal sessionFactory, String name, String username, String password, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge, boolean blockOnAcknowledge, boolean autoGroup, int ackBatchSize, int consumerWindowSize, int consumerMaxRate, int confirmationWindowSize, int producerWindowSize, int producerMaxRate, boolean blockOnNonDurableSend, boolean blockOnDurableSend, boolean cacheLargeMessageClient, int minLargeMessageSize, boolean compressLargeMessages, int initialMessagePacketSize, String groupID, CoreRemotingConnection remotingConnection, int version, Channel channel, Executor executor, Executor flowControlExecutor) throws HornetQException
HornetQException
public Channel getChannel()
getChannel
in interface ClientSessionInternal
public void createQueue(SimpleString address, SimpleString queueName) throws HornetQException
ClientSession
createQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queueHornetQException
- in an exception occurs while creating the queuepublic void createQueue(SimpleString address, SimpleString queueName, boolean durable) throws HornetQException
ClientSession
createQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- whether the queue is durable or notHornetQException
- in an exception occurs while creating the queuepublic void createQueue(String address, String queueName, boolean durable) throws HornetQException
ClientSession
createQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queuedurable
- whether the queue is durable or notHornetQException
- in an exception occurs while creating the queuepublic void createQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable) throws HornetQException
ClientSession
createQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queuefilterString
- only messages which match this filter will be put in the queuedurable
- whether the queue is durable or notHornetQException
- in an exception occurs while creating the queuepublic void createQueue(String address, String queueName, String filterString, boolean durable) throws HornetQException
ClientSession
createQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queuefilterString
- only messages which match this filter will be put in the queuedurable
- whether the queue is durable or notHornetQException
- in an exception occurs while creating the queuepublic void createTemporaryQueue(SimpleString address, SimpleString queueName) throws HornetQException
ClientSession
createTemporaryQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queueHornetQException
- in an exception occurs while creating the queuepublic void createTemporaryQueue(String address, String queueName) throws HornetQException
ClientSession
createTemporaryQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queueHornetQException
- in an exception occurs while creating the queuepublic void createTemporaryQueue(SimpleString address, SimpleString queueName, SimpleString filter) throws HornetQException
ClientSession
createTemporaryQueue
in interface ClientSession
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 queueHornetQException
- in an exception occurs while creating the queuepublic void createTemporaryQueue(String address, String queueName, String filter) throws HornetQException
ClientSession
createTemporaryQueue
in interface ClientSession
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 queueHornetQException
- in an exception occurs while creating the queuepublic void deleteQueue(SimpleString queueName) throws HornetQException
ClientSession
deleteQueue
in interface ClientSession
queueName
- the name of the queue to deleteHornetQException
- if there is no queue for the given name or if the queue has consumerspublic void deleteQueue(String queueName) throws HornetQException
ClientSession
deleteQueue
in interface ClientSession
queueName
- the name of the queue to deleteHornetQException
- if there is no queue for the given name or if the queue has consumerspublic ClientSession.QueueQuery queueQuery(SimpleString queueName) throws HornetQException
ClientSession
queueQuery
in interface ClientSession
queueName
- the name of the queue to queryHornetQException
- if an exception occurs while querying the queuepublic ClientSession.BindingQuery bindingQuery(SimpleString address) throws HornetQException
ClientSession
bindingQuery
in interface ClientSession
address
- the address of the biding to queryHornetQException
- if an exception occurs while querying the bindingpublic void forceDelivery(long consumerID, long sequence) throws HornetQException
forceDelivery
in interface ClientSessionInternal
HornetQException
public ClientConsumer createConsumer(SimpleString queueName) throws HornetQException
ClientSession
createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromHornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(String queueName) throws HornetQException
ClientSession
createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromHornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(SimpleString queueName, SimpleString filterString) throws HornetQException
ClientSession
createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromfilterString
- only messages which match this filter will be consumedHornetQException
- if an exception occurs while creating the ClientConsumerpublic void createQueue(String address, String queueName) throws HornetQException
ClientSession
createQueue
in interface ClientSession
address
- the queue will be bound to this addressqueueName
- the name of the queueHornetQException
- in an exception occurs while creating the queuepublic ClientConsumer createConsumer(String queueName, String filterString) throws HornetQException
ClientSession
createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromfilterString
- only messages which match this filter will be consumedHornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(SimpleString queueName, SimpleString filterString, boolean browseOnly) throws HornetQException
ClientSession
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).
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.createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromfilterString
- only messages which match this filter will be consumedbrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.HornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(SimpleString queueName, boolean browseOnly) throws HornetQException
ClientSession
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).
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.createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages frombrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.HornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(String queueName, String filterString, boolean browseOnly) throws HornetQException
ClientSession
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).
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.createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromfilterString
- only messages which match this filter will be consumedbrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.HornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(String queueName, boolean browseOnly) throws HornetQException
ClientSession
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).
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.createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages frombrowseOnly
- whether the ClientConsumer will only browse the queue or consume messages.HornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(SimpleString queueName, SimpleString filterString, int windowSize, int maxRate, boolean browseOnly) throws HornetQException
ClientSession
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).
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.createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromfilterString
- 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.HornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientConsumer createConsumer(String queueName, String filterString, int windowSize, int maxRate, boolean browseOnly) throws HornetQException
ClientSession
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).
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.createConsumer
in interface ClientSession
queueName
- name of the queue to consume messages fromfilterString
- 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.HornetQException
- if an exception occurs while creating the ClientConsumerpublic ClientProducer createProducer() throws HornetQException
ClientSession
createProducer
in interface ClientSession
HornetQException
ClientProducer.send(SimpleString, org.hornetq.api.core.Message)
public ClientProducer createProducer(SimpleString address) throws HornetQException
ClientSession
createProducer
in interface ClientSession
address
- the address to send messages toHornetQException
- if an exception occurs while creating the ClientProducerpublic ClientProducer createProducer(String address) throws HornetQException
ClientSession
createProducer
in interface ClientSession
address
- the address to send messages toHornetQException
- if an exception occurs while creating the ClientProducerpublic ClientProducer createProducer(SimpleString address, int maxRate) throws HornetQException
ClientSession
createProducer
in interface ClientSession
address
- the address to send messages tomaxRate
- the producer rateHornetQException
- if an exception occurs while creating the ClientProducerpublic ClientProducer createProducer(String address, int rate) throws HornetQException
HornetQException
public XAResource getXAResource()
ClientSession
getXAResource
in interface ClientSession
public void commit() throws HornetQException
ClientSession
commit
in interface ClientSession
HornetQException
- if an exception occurs while committing the transactionpublic boolean isRollbackOnly()
ClientSession
true
if the current transaction has been flagged to rollback, false
else.isRollbackOnly
in interface ClientSession
true
if the current transaction has been flagged to rollback, false
else.public void rollback() throws HornetQException
ClientSession
rollback
in interface ClientSession
HornetQException
- if an exception occurs while rolling back the transactionpublic void rollback(boolean isLastMessageAsDelivered) throws HornetQException
ClientSession
rollback
in interface ClientSession
isLastMessageAsDelivered
- the first message on deliveringMessage Buffer is considered as deliveredHornetQException
- if an exception occurs while rolling back the transactionpublic ClientMessage createMessage(byte type, boolean durable, long expiration, long timestamp, byte priority)
ClientSession
createMessage
in interface ClientSession
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)public ClientMessage createMessage(byte type, boolean durable)
ClientSession
createMessage
in interface ClientSession
type
- type of the messagedurable
- whether the created message is durable or notpublic ClientMessage createMessage(boolean durable)
ClientSession
createMessage
in interface ClientSession
durable
- whether the created message is durable or notpublic boolean isClosed()
ClientSession
isClosed
in interface ClientSession
true
if the session is closed, false
elsepublic boolean isAutoCommitSends()
ClientSession
false
elseisAutoCommitSends
in interface ClientSession
true
if the session automatically commit its transaction every time a message is sent, false
elsepublic boolean isAutoCommitAcks()
ClientSession
false
elseisAutoCommitAcks
in interface ClientSession
true
if the session automatically commit its transaction every time a message is acknowledged, false
elsepublic boolean isBlockOnAcknowledge()
ClientSession
isBlockOnAcknowledge
in interface ClientSession
true
if the session's ClientConsumer block when they acknowledge a message, false
elsepublic boolean isXA()
ClientSession
true
if the session supports XA, false
else.isXA
in interface ClientSession
true
if the session supports XA, false
else.public void resetIfNeeded() throws HornetQException
resetIfNeeded
in interface ClientSessionInternal
HornetQException
public void start() throws HornetQException
ClientSession
start
in interface ClientSession
HornetQException
- if an exception occurs while starting the sessionpublic void stop() throws HornetQException
ClientSession
stop
in interface ClientSession
HornetQException
- if an exception occurs while stopping the sessionpublic void stop(boolean waitForOnMessage) throws HornetQException
HornetQException
public void addFailureListener(SessionFailureListener listener)
ClientSession
addFailureListener
in interface ClientSession
listener
- the listener to addpublic boolean removeFailureListener(SessionFailureListener listener)
ClientSession
removeFailureListener
in interface ClientSession
listener
- the listener to removetrue
if the listener was removed, false
elsepublic int getVersion()
ClientSession
getVersion
in interface ClientSession
incrementingVersion
public int getMinLargeMessageSize()
getMinLargeMessageSize
in interface ClientSessionInternal
public boolean isCompressLargeMessages()
isCompressLargeMessages
in interface ClientSessionInternal
public boolean isCacheLargeMessageClient()
isCacheLargeMessageClient
in interface ClientSessionInternal
public String getName()
getName
in interface ClientSessionInternal
public void acknowledge(long consumerID, long messageID) throws HornetQException
acknowledge
in interface ClientSessionInternal
HornetQException
public void individualAcknowledge(long consumerID, long messageID) throws HornetQException
individualAcknowledge
in interface ClientSessionInternal
HornetQException
public void expire(long consumerID, long messageID) throws HornetQException
expire
in interface ClientSessionInternal
HornetQException
public void addConsumer(ClientConsumerInternal consumer)
addConsumer
in interface ClientSessionInternal
public void addProducer(ClientProducerInternal producer)
addProducer
in interface ClientSessionInternal
public void removeConsumer(ClientConsumerInternal consumer) throws HornetQException
removeConsumer
in interface ClientSessionInternal
HornetQException
public void removeProducer(ClientProducerInternal producer)
removeProducer
in interface ClientSessionInternal
public void handleReceiveMessage(long consumerID, SessionReceiveMessage message) throws Exception
handleReceiveMessage
in interface ClientSessionInternal
Exception
public void handleReceiveLargeMessage(long consumerID, SessionReceiveLargeMessage message) throws Exception
handleReceiveLargeMessage
in interface ClientSessionInternal
Exception
public void handleReceiveContinuation(long consumerID, SessionReceiveContinuationMessage continuation) throws Exception
handleReceiveContinuation
in interface ClientSessionInternal
Exception
public void close() throws HornetQException
ClientSession
close
in interface ClientSession
HornetQException
- if an exception occurs while closing the sessionpublic void cleanUp(boolean failingOver) throws Exception
cleanUp
in interface ClientSessionInternal
Exception
public void setSendAcknowledgementHandler(SendAcknowledgementHandler handler)
ClientSession
SendAcknowledgementHandler
for this session.setSendAcknowledgementHandler
in interface ClientSession
handler
- a SendAcknowledgementHandlerpublic void preHandleFailover(CoreRemotingConnection connection)
preHandleFailover
in interface ClientSessionInternal
public void handleFailover(CoreRemotingConnection backupConnection)
handleFailover
in interface ClientSessionInternal
public void addMetaDataV1(String key, String data) throws HornetQException
ClientSession
addMetaDataV1
in interface ClientSession
HornetQException
public void addMetaData(String key, String data) throws HornetQException
ClientSession
addMetaData
in interface ClientSession
HornetQException
public void addUniqueMetaData(String key, String data) throws HornetQException
ClientSession
addUniqueMetaData
in interface ClientSession
HornetQException
public ClientSessionFactoryInternal getSessionFactory()
getSessionFactory
in interface ClientSessionInternal
public void setAddress(Message message, SimpleString address)
setAddress
in interface ClientSessionInternal
public void setPacketSize(int packetSize)
setPacketSize
in interface ClientSessionInternal
public void workDone()
workDone
in interface ClientSessionInternal
public void returnBlocking()
returnBlocking
in interface ClientSessionInternal
public void sendProducerCreditsMessage(int credits, SimpleString address)
sendProducerCreditsMessage
in interface ClientSessionInternal
public ClientProducerCredits getCredits(SimpleString address, boolean anon)
getCredits
in interface ClientSessionInternal
public void returnCredits(SimpleString address)
returnCredits
in interface ClientSessionInternal
public void handleReceiveProducerCredits(SimpleString address, int credits)
handleReceiveProducerCredits
in interface ClientSessionInternal
public ClientProducerCreditManager getProducerCreditManager()
getProducerCreditManager
in interface ClientSessionInternal
public void commandConfirmed(Packet packet)
CommandConfirmationHandler
commandConfirmed
in interface CommandConfirmationHandler
packet
- the packet confirmedpublic void commit(Xid xid, boolean onePhase) throws XAException
XAResource
onePhase
argument is true, one-phase
optimization is being used, and the prepare
method must not have been called for this transaction.
Otherwise, this is the second phase of the two-phase commit protocol.commit
in interface XAResource
xid
- The id of the transaction to commit work for.onePhase
- If true, the transaction manager is using one-phase
optimization.XAException
- If an error occurred.public void end(Xid xid, int flags) throws XAException
XAResource
XAResource.TMSUCCESS
, the portion of work
was done sucessfully.
If the flags argument is XAResource.TMFAIL
, the portion of work
failed. The resource manager may mark the transaction for
rollback only to avoid the transaction being committed.
If the flags argument is XAResource.TMSUSPEND
the resource will
temporarily suspend the transaction association. The transaction
must later be re-associated by giving the XAResource.TMRESUME
flag
to the start
method.end
in interface XAResource
xid
- The id of the transaction to disassociate from.flags
- Must be either XAResource.TMSUCCESS
, XAResource.TMFAIL
or XAResource.TMSUSPEND
.XAException
- If an error occurred.public void forget(Xid xid) throws XAException
XAResource
forget
in interface XAResource
xid
- The id of the transaction that was ended with a heuristic
decision.XAException
- If an error occurred.public int getTransactionTimeout() throws XAException
XAResource
getTransactionTimeout
in interface XAResource
XAException
- If an error occurred.public boolean isSameRM(XAResource xares) throws XAException
XAResource
start
method should be given the
XAResource.TMJOIN
flag.isSameRM
in interface XAResource
XAException
- If an error occurred.public int prepare(Xid xid) throws XAException
XAResource
XAException
at the
caller.prepare
in interface XAResource
xid
- The id of the transaction to prepare to commit work for.XAResource.XA_OK
or XAResource.XA_RDONLY
.XAException
- If an error occurred.public Xid[] recover(int flags) throws XAException
XAResource
A recovery scan is done with one or more calls to this method.
At the first call, XAResource.TMSTARTRSCAN
must be in the
flag
argument to indicate that the scan should be started.
During the recovery scan, the resource manager maintains an internal
cursor that keeps track of the progress of the recovery scan.
To end the recovery scan, the XAResource.TMENDRSCAN
must be passed
in the flag
argument.
recover
in interface XAResource
flags
- Must be either XAResource.TMNOFLAGS
, XAResource.TMSTARTRSCAN
,
XAResource.TMENDRSCAN
or TMSTARTRSCAN|TMENDRSCAN
.XAException
- If an error occurred.public void rollback(Xid xid) throws XAException
XAResource
rollback
in interface XAResource
xid
- The id of the transaction to commit work for.XAException
- If an error occurred.public boolean setTransactionTimeout(int seconds) throws XAException
XAResource
seconds
argument is 0
, the
timeout value is set to the default timeout value of the resource
manager.
Not all resource managers support setting the timeout value.
If the resource manager does not support setting the timeout
value, it should return false.setTransactionTimeout
in interface XAResource
seconds
- The timeout value, in seconds.XAException
- If an error occurred.public void start(Xid xid, int flags) throws XAException
XAResource
XAResource.TMNOFLAGS
, the transaction must not
previously have been seen by this resource manager, or an
XAException
with error code XAER_DUPID will be thrown.
If the flags argument is XAResource.TMJOIN
, the resource will join a
transaction previously seen by tis resource manager.
If the flags argument is XAResource.TMRESUME
the resource will
resume the transaction association that was suspended with
end(TMSUSPEND).start
in interface XAResource
xid
- The id of the transaction to associate with.flags
- Must be either XAResource.TMNOFLAGS
, XAResource.TMJOIN
or XAResource.TMRESUME
.XAException
- If an error occurred.public void connectionFailed(HornetQException me, boolean failedOver)
FailureListener
connectionFailed
in interface FailureListener
me
- exception which has caused the connection to failpublic void setForceNotSameRM(boolean force)
setForceNotSameRM
in interface ClientSessionInternal
public RemotingConnection getConnection()
getConnection
in interface ClientSessionInternal
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.