Class SessionContext
- java.lang.Object
-
- org.apache.activemq.artemis.spi.core.remoting.SessionContext
-
public abstract class SessionContext extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected IDGeneratoridGeneratorprotected RemotingConnectionremotingConnectionprotected SendAcknowledgementHandlersendAckHandlerprotected org.apache.activemq.artemis.core.client.impl.ClientSessionInternalsession
-
Constructor Summary
Constructors Constructor Description SessionContext(RemotingConnection remotingConnection)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract ClientSession.AddressQueryaddressQuery(SimpleString address)abstract voidaddSessionMetadata(String key, String data)abstract voidaddUniqueMetaData(String key, String data)abstract voidcleanup()abstract voidcloseConsumer(ClientConsumer consumer)abstract booleanconfigureTransactionTimeout(int seconds)abstract voidcreateAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated)abstract voidcreateAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated)Deprecated.abstract org.apache.activemq.artemis.core.client.impl.ClientConsumerInternalcreateConsumer(SimpleString queueName, SimpleString filterString, int priority, int windowSize, int maxRate, int ackBatchSize, boolean browseOnly, Executor executor, Executor flowControlExecutor)abstract voidcreateProducer(org.apache.activemq.artemis.core.client.impl.ClientProducerInternal producer)abstract voidcreateQueue(QueueConfiguration queueConfiguration)abstract voidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated)Deprecated.abstract voidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated, Boolean exclusive, Boolean lastVale)abstract voidcreateQueue(SimpleString address, SimpleString queueName, boolean temp, boolean autoCreated, QueueAttributes queueAttributes)abstract voidcreateQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, boolean autoCreated)Deprecated.abstract voidcreateSharedQueue(QueueConfiguration queueConfiguration)abstract voidcreateSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes)Deprecated.abstract voidcreateSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable)Deprecated.abstract voidcreateSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue)Deprecated.abstract voidcreateSharedQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable)Deprecated.abstract voiddeleteQueue(SimpleString queueName)abstract voidexpireMessage(ClientConsumer consumer, Message message)abstract voidforceDelivery(ClientConsumer consumer, long sequence)abstract intgetCreditsOnSendingFull(Message msgI)abstract intgetDefaultConsumerWindowSize(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage response)abstract intgetReconnectID()RemotingConnectiongetRemotingConnection()abstract SendAcknowledgementHandlergetSendAcknowledgementHandler()abstract intgetServerVersion()org.apache.activemq.artemis.core.client.impl.ClientSessionInternalgetSession()protected voidhandleReceiveContinuation(ConsumerContext consumerID, byte[] chunk, int flowControlSize, boolean isContinues)protected voidhandleReceiveLargeMessage(ConsumerContext consumerID, org.apache.activemq.artemis.core.client.impl.ClientLargeMessageInternal clientLargeMessage, long largeMessageSize)protected voidhandleReceiveMessage(ConsumerContext consumerID, org.apache.activemq.artemis.core.client.impl.ClientMessageInternal message)protected voidhandleReceiveProducerCredits(SimpleString address, int credits)protected voidhandleReceiveProducerFailCredits(SimpleString address, int credits)abstract booleanisWritable(ReadyListener callback)abstract voidlinkFlowControl(SimpleString address, org.apache.activemq.artemis.core.client.impl.ClientProducerCredits clientProducerCredits)abstract voidlockCommunications()it will lock the communication channel of the session avoiding anything to come while failover is happening.abstract ClientSession.QueueQueryqueueQuery(SimpleString queueName)abstract booleanreattachOnNewConnection(RemotingConnection newConnection)it will either reattach or reconnect, preferably reattaching it.abstract intrecoverSessionTimeout()Performs a round trip to the server requesting what is the current tx timeout on the sessionabstract voidrecreateConsumerOnServer(org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal consumerInternal, long consumerId, boolean isSessionStarted)abstract voidrecreateSession(String username, String password, int minLargeMessageSize, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge)abstract voidreleaseCommunications()abstract voidremoveProducer(int id)abstract voidresetMetadata(HashMap<String,String> metaDataToSend)abstract voidresetName(String name)abstract voidrestartSession()abstract voidreturnBlocking(ActiveMQException cause)Interrupt and return any blocked callsabstract voidsendACK(boolean individual, boolean block, ClientConsumer consumer, Message message)abstract voidsendConsumerCredits(ClientConsumer consumer, int credits)abstract voidsendFullMessage(ICoreMessage msgI, boolean sendBlocking, SendAcknowledgementHandler handler, SimpleString defaultAddress, int senderID)abstract intsendInitialChunkOnLargeMessage(Message msgI)it should return the number of credits (or bytes) used to send this packetabstract intsendLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int reconnectID, int senderID, SendAcknowledgementHandler messageHandler)abstract voidsendProducerCreditsMessage(int credits, SimpleString address)abstract intsendServerLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int senderID, SendAcknowledgementHandler messageHandler)abstract voidsessionClose()abstract voidsessionStart()abstract voidsessionStop()abstract voidsetSendAcknowledgementHandler(SendAcknowledgementHandler handler)voidsetSession(org.apache.activemq.artemis.core.client.impl.ClientSessionInternal session)abstract voidsimpleCommit()abstract voidsimpleCommit(boolean block)abstract voidsimpleRollback(boolean lastMessageAsDelivered)If we are doing a simple rollback on the RA, we need to ack the last message sent to the consumer, otherwise DLQ won't work.abstract booleansupportsLargeMessage()abstract voidtransferConnection(RemotingConnection newConnection)Transfers the session context to the given newConnection on the client-sideabstract voidxaCommit(Xid xid, boolean onePhase)abstract voidxaEnd(Xid xid, int flags)abstract voidxaFailed(Xid xid)abstract voidxaForget(Xid xid)abstract intxaPrepare(Xid xid)abstract voidxaRollback(Xid xid, boolean wasStarted)abstract Xid[]xaScan()abstract voidxaStart(Xid xid, int flags)
-
-
-
Field Detail
-
session
protected org.apache.activemq.artemis.core.client.impl.ClientSessionInternal session
-
sendAckHandler
protected SendAcknowledgementHandler sendAckHandler
-
remotingConnection
protected volatile RemotingConnection remotingConnection
-
idGenerator
protected final IDGenerator idGenerator
-
-
Constructor Detail
-
SessionContext
public SessionContext(RemotingConnection remotingConnection)
-
-
Method Detail
-
getSession
public org.apache.activemq.artemis.core.client.impl.ClientSessionInternal getSession()
-
setSession
public void setSession(org.apache.activemq.artemis.core.client.impl.ClientSessionInternal session)
-
resetName
public abstract void resetName(String name)
-
getReconnectID
public abstract int getReconnectID()
-
transferConnection
public abstract void transferConnection(RemotingConnection newConnection)
Transfers the session context to the given newConnection on the client-side
-
reattachOnNewConnection
public abstract boolean reattachOnNewConnection(RemotingConnection newConnection) throws ActiveMQException
it will either reattach or reconnect, preferably reattaching it.- Parameters:
newConnection-- Returns:
- true if it was possible to reattach
- Throws:
ActiveMQException
-
getRemotingConnection
public RemotingConnection getRemotingConnection()
-
closeConsumer
public abstract void closeConsumer(ClientConsumer consumer) throws ActiveMQException
- Throws:
ActiveMQException
-
sendConsumerCredits
public abstract void sendConsumerCredits(ClientConsumer consumer, int credits)
-
supportsLargeMessage
public abstract boolean supportsLargeMessage()
-
handleReceiveLargeMessage
protected void handleReceiveLargeMessage(ConsumerContext consumerID, org.apache.activemq.artemis.core.client.impl.ClientLargeMessageInternal clientLargeMessage, long largeMessageSize) throws Exception
- Throws:
Exception
-
handleReceiveMessage
protected void handleReceiveMessage(ConsumerContext consumerID, org.apache.activemq.artemis.core.client.impl.ClientMessageInternal message) throws Exception
- Throws:
Exception
-
handleReceiveContinuation
protected void handleReceiveContinuation(ConsumerContext consumerID, byte[] chunk, int flowControlSize, boolean isContinues) throws Exception
- Throws:
Exception
-
handleReceiveProducerCredits
protected void handleReceiveProducerCredits(SimpleString address, int credits)
-
handleReceiveProducerFailCredits
protected void handleReceiveProducerFailCredits(SimpleString address, int credits)
-
getCreditsOnSendingFull
public abstract int getCreditsOnSendingFull(Message msgI)
-
sendFullMessage
public abstract void sendFullMessage(ICoreMessage msgI, boolean sendBlocking, SendAcknowledgementHandler handler, SimpleString defaultAddress, int senderID) throws ActiveMQException
- Throws:
ActiveMQException
-
sendInitialChunkOnLargeMessage
public abstract int sendInitialChunkOnLargeMessage(Message msgI) throws ActiveMQException
it should return the number of credits (or bytes) used to send this packet- Parameters:
msgI-- Returns:
- Throws:
ActiveMQException
-
sendLargeMessageChunk
public abstract int sendLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int reconnectID, int senderID, SendAcknowledgementHandler messageHandler) throws ActiveMQException
- Throws:
ActiveMQException
-
sendServerLargeMessageChunk
public abstract int sendServerLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int senderID, SendAcknowledgementHandler messageHandler) throws ActiveMQException
- Throws:
ActiveMQException
-
setSendAcknowledgementHandler
public abstract void setSendAcknowledgementHandler(SendAcknowledgementHandler handler)
-
getSendAcknowledgementHandler
public abstract SendAcknowledgementHandler getSendAcknowledgementHandler()
-
createSharedQueue
@Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException
Deprecated.Creates a shared queue using the routing type set by the Address. If the Address supports more than one type of delivery then the default delivery mode (MULTICAST) is used.- Parameters:
address-queueName-routingType-filterString-durable-exclusive-lastValue-- Throws:
ActiveMQException
-
createSharedQueue
@Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException
Deprecated.Creates a shared queue using the routing type set by the Address. If the Address supports more than one type of delivery then the default delivery mode (MULTICAST) is used.- Parameters:
address-queueName-queueAttributes-- Throws:
ActiveMQException
-
createSharedQueue
@Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable) throws ActiveMQException
Deprecated.- Throws:
ActiveMQException
-
createSharedQueue
@Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable) throws ActiveMQException
Deprecated.- Throws:
ActiveMQException
-
createSharedQueue
public abstract void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException
- Throws:
ActiveMQException
-
deleteQueue
public abstract void deleteQueue(SimpleString queueName) throws ActiveMQException
- Throws:
ActiveMQException
-
createAddress
@Deprecated public abstract void createAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException
Deprecated.- Throws:
ActiveMQException
-
createAddress
public abstract void createAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException
- Throws:
ActiveMQException
-
createQueue
@Deprecated public abstract void createQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, boolean autoCreated) throws ActiveMQException
Deprecated.- Throws:
ActiveMQException
-
createQueue
@Deprecated public abstract void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated) throws ActiveMQException
Deprecated.- Throws:
ActiveMQException
-
createQueue
public abstract void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated, Boolean exclusive, Boolean lastVale) throws ActiveMQException
- Throws:
ActiveMQException
-
createQueue
public abstract void createQueue(SimpleString address, SimpleString queueName, boolean temp, boolean autoCreated, QueueAttributes queueAttributes) throws ActiveMQException
- Throws:
ActiveMQException
-
createQueue
public abstract void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException
- Throws:
ActiveMQException
-
queueQuery
public abstract ClientSession.QueueQuery queueQuery(SimpleString queueName) throws ActiveMQException
- Throws:
ActiveMQException
-
forceDelivery
public abstract void forceDelivery(ClientConsumer consumer, long sequence) throws ActiveMQException
- Throws:
ActiveMQException
-
addressQuery
public abstract ClientSession.AddressQuery addressQuery(SimpleString address) throws ActiveMQException
- Throws:
ActiveMQException
-
simpleCommit
public abstract void simpleCommit() throws ActiveMQException- Throws:
ActiveMQException
-
simpleCommit
public abstract void simpleCommit(boolean block) throws ActiveMQException- Throws:
ActiveMQException
-
simpleRollback
public abstract void simpleRollback(boolean lastMessageAsDelivered) throws ActiveMQExceptionIf we are doing a simple rollback on the RA, we need to ack the last message sent to the consumer, otherwise DLQ won't work.this is because we only ACK after on the RA, We may review this if we always acked earlier.
- Parameters:
lastMessageAsDelivered-- Throws:
ActiveMQException
-
sessionStart
public abstract void sessionStart() throws ActiveMQException- Throws:
ActiveMQException
-
sessionStop
public abstract void sessionStop() throws ActiveMQException- Throws:
ActiveMQException
-
sendACK
public abstract void sendACK(boolean individual, boolean block, ClientConsumer consumer, Message message) throws ActiveMQException- Throws:
ActiveMQException
-
expireMessage
public abstract void expireMessage(ClientConsumer consumer, Message message) throws ActiveMQException
- Throws:
ActiveMQException
-
sessionClose
public abstract void sessionClose() throws ActiveMQException- Throws:
ActiveMQException
-
addSessionMetadata
public abstract void addSessionMetadata(String key, String data) throws ActiveMQException
- Throws:
ActiveMQException
-
addUniqueMetaData
public abstract void addUniqueMetaData(String key, String data) throws ActiveMQException
- Throws:
ActiveMQException
-
sendProducerCreditsMessage
public abstract void sendProducerCreditsMessage(int credits, SimpleString address)
-
xaCommit
public abstract void xaCommit(Xid xid, boolean onePhase) throws XAException, ActiveMQException
- Throws:
XAExceptionActiveMQException
-
xaEnd
public abstract void xaEnd(Xid xid, int flags) throws XAException, ActiveMQException
- Throws:
XAExceptionActiveMQException
-
xaForget
public abstract void xaForget(Xid xid) throws XAException, ActiveMQException
- Throws:
XAExceptionActiveMQException
-
xaPrepare
public abstract int xaPrepare(Xid xid) throws XAException, ActiveMQException
- Throws:
XAExceptionActiveMQException
-
xaScan
public abstract Xid[] xaScan() throws ActiveMQException
- Throws:
ActiveMQException
-
xaRollback
public abstract void xaRollback(Xid xid, boolean wasStarted) throws ActiveMQException, XAException
- Throws:
ActiveMQExceptionXAException
-
xaStart
public abstract void xaStart(Xid xid, int flags) throws XAException, ActiveMQException
- Throws:
XAExceptionActiveMQException
-
configureTransactionTimeout
public abstract boolean configureTransactionTimeout(int seconds) throws ActiveMQException- Throws:
ActiveMQException
-
createConsumer
public abstract org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal createConsumer(SimpleString queueName, SimpleString filterString, int priority, int windowSize, int maxRate, int ackBatchSize, boolean browseOnly, Executor executor, Executor flowControlExecutor) throws ActiveMQException
- Throws:
ActiveMQException
-
recoverSessionTimeout
public abstract int recoverSessionTimeout() throws ActiveMQExceptionPerforms a round trip to the server requesting what is the current tx timeout on the session- Returns:
- Throws:
ActiveMQException
-
getServerVersion
public abstract int getServerVersion()
-
recreateSession
public abstract void recreateSession(String username, String password, int minLargeMessageSize, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge) throws ActiveMQException
- Throws:
ActiveMQException
-
recreateConsumerOnServer
public abstract void recreateConsumerOnServer(org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal consumerInternal, long consumerId, boolean isSessionStarted) throws ActiveMQException- Throws:
ActiveMQException
-
xaFailed
public abstract void xaFailed(Xid xid) throws ActiveMQException
- Throws:
ActiveMQException
-
restartSession
public abstract void restartSession() throws ActiveMQException- Throws:
ActiveMQException
-
getDefaultConsumerWindowSize
public abstract int getDefaultConsumerWindowSize(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage response) throws ActiveMQException- Throws:
ActiveMQException
-
returnBlocking
public abstract void returnBlocking(ActiveMQException cause)
Interrupt and return any blocked calls
-
lockCommunications
public abstract void lockCommunications()
it will lock the communication channel of the session avoiding anything to come while failover is happening. It happens on preFailover from ClientSessionImpl
-
releaseCommunications
public abstract void releaseCommunications()
-
cleanup
public abstract void cleanup()
-
linkFlowControl
public abstract void linkFlowControl(SimpleString address, org.apache.activemq.artemis.core.client.impl.ClientProducerCredits clientProducerCredits)
-
isWritable
public abstract boolean isWritable(ReadyListener callback)
-
createProducer
public abstract void createProducer(org.apache.activemq.artemis.core.client.impl.ClientProducerInternal producer)
-
removeProducer
public abstract void removeProducer(int id)
-
-