Class ActiveMQSessionContext
java.lang.Object
org.apache.activemq.artemis.spi.core.remoting.SessionContext
org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext
- Direct Known Subclasses:
HornetQClientSessionContext
-
Field Summary
Fields inherited from class org.apache.activemq.artemis.spi.core.remoting.SessionContext
idGenerator, remotingConnection, sendAckHandler, session -
Constructor Summary
ConstructorsConstructorDescriptionActiveMQSessionContext(String name, RemotingConnection remotingConnection, Channel sessionChannel, int serverVersion, int confirmationWindow) -
Method Summary
Modifier and TypeMethodDescriptionaddressQuery(SimpleString address) voidaddSessionMetadata(String key, String data) voidaddUniqueMetaData(String key, String data) protected intcalcWindowSize(int windowSize) voidcleanup()voidcloseConsumer(ClientConsumer consumer) booleanconfigureTransactionTimeout(int seconds) voidcreateAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) voidcreateAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) createConsumer(SimpleString queueName, SimpleString filterString, int priority, int windowSize, int maxRate, int ackBatchSize, boolean browseOnly, Executor executor, Executor flowControlExecutor, int onMessageCloseTimeout) voidcreateProducer(ClientProducerInternal producer) voidcreateQueue(QueueConfiguration queueConfiguration) voidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated) Deprecated.voidcreateQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated, Boolean exclusive, Boolean lastValue) Deprecated.voidcreateQueue(SimpleString address, SimpleString queueName, boolean temp, boolean autoCreated, QueueAttributes queueAttributes) Deprecated.voidcreateQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, boolean autoCreated) Deprecated.voidcreateSharedQueue(QueueConfiguration queueConfiguration) voidcreateSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) Deprecated.voidcreateSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable) Deprecated.voidcreateSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) Deprecated.voidcreateSharedQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable) Deprecated.voiddeleteQueue(SimpleString queueName) voidexpireMessage(ClientConsumer consumer, Message message) voidforceDelivery(ClientConsumer consumer, long sequence) protected intintintprotected StringgetName()intintprotected voidprotected voidprotected voidbooleanisKilled()booleanisWritable(ReadyListener callback) voidkill()voidlinkFlowControl(SimpleString address, ClientProducerCredits clientProducerCredits) voidit will lock the communication channel of the session avoiding anything to come while failover is happening.protected ClassLoaderprotected CreateSessionMessagenewCreateSession(String username, String password, int minLargeMessageSize, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge) queueQuery(SimpleString queueName) booleanreattachOnNewConnection(RemotingConnection newConnection) it will either reattach or reconnect, preferably reattaching it.intPerforms a round trip to the server requesting what is the current tx timeout on the sessionvoidrecreateConsumerOnServer(ClientConsumerInternal consumerInternal, long consumerId, boolean isSessionStarted) voidrecreateSession(String username, String password, int minLargeMessageSize, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge) voidvoidremoveProducer(int id) voidresetMetadata(Map<String, String> metaDataToSend) voidvoidvoidreturnBlocking(ActiveMQException cause) Interrupt and return any blocked callsvoidsendACK(boolean individual, boolean block, ClientConsumer consumer, Message message) voidsendConsumerCredits(ClientConsumer consumer, int credits) voidsendFullMessage(ICoreMessage msgI, boolean sendBlocking, SendAcknowledgementHandler handler, SimpleString defaultAddress, int senderID) intit should return the number of credits (or bytes) used to send this packetintsendLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int reconnectID, int senderID, SendAcknowledgementHandler messageHandler) voidsendProducerCreditsMessage(int credits, SimpleString address) intsendServerLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int senderID, SendAcknowledgementHandler messageHandler) voidvoidvoidvoidvoidvoidsimpleCommit(boolean block) 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.booleanActiveMQ Artemis does support large messagesvoidtransferConnection(RemotingConnection newConnection) Transfers the session context to the given newConnection on the client-sidevoidvoidvoidvoidintvoidxaRollback(Xid xid, boolean wasStarted) Xid[]xaScan()voidMethods inherited from class org.apache.activemq.artemis.spi.core.remoting.SessionContext
getRemotingConnection, getSession, handleReceiveContinuation, handleReceiveLargeMessage, handleReceiveMessage, handleReceiveProducerCredits, handleReceiveProducerFailCredits, setSession
-
Constructor Details
-
ActiveMQSessionContext
public ActiveMQSessionContext(String name, RemotingConnection remotingConnection, Channel sessionChannel, int serverVersion, int confirmationWindow)
-
-
Method Details
-
getSessionChannel
-
getName
-
resetName
- Specified by:
resetNamein classSessionContext
-
getConfirmationWindow
protected int getConfirmationWindow() -
getReconnectID
public int getReconnectID()- Specified by:
getReconnectIDin classSessionContext
-
isKilled
public boolean isKilled() -
kill
public void kill() -
returnBlocking
Description copied from class:SessionContextInterrupt and return any blocked calls- Specified by:
returnBlockingin classSessionContext
-
lockCommunications
public void lockCommunications()Description copied from class:SessionContextit will lock the communication channel of the session avoiding anything to come while failover is happening. It happens on preFailover from ClientSessionImpl- Specified by:
lockCommunicationsin classSessionContext
-
releaseCommunications
public void releaseCommunications()- Specified by:
releaseCommunicationsin classSessionContext
-
cleanup
public void cleanup()- Specified by:
cleanupin classSessionContext
-
linkFlowControl
- Specified by:
linkFlowControlin classSessionContext
-
setSendAcknowledgementHandler
- Specified by:
setSendAcknowledgementHandlerin classSessionContext
-
getSendAcknowledgementHandler
- Specified by:
getSendAcknowledgementHandlerin classSessionContext
-
deleteQueue
- Specified by:
deleteQueuein classSessionContext- Throws:
ActiveMQException
-
queueQuery
- Specified by:
queueQueryin classSessionContext- Throws:
ActiveMQException
-
isWritable
- Specified by:
isWritablein classSessionContext
-
createProducer
- Specified by:
createProducerin classSessionContext
-
removeProducer
public void removeProducer(int id) - Specified by:
removeProducerin classSessionContext
-
createConsumer
public ClientConsumerInternal createConsumer(SimpleString queueName, SimpleString filterString, int priority, int windowSize, int maxRate, int ackBatchSize, boolean browseOnly, Executor executor, Executor flowControlExecutor, int onMessageCloseTimeout) throws ActiveMQException - Specified by:
createConsumerin classSessionContext- Throws:
ActiveMQException
-
getServerVersion
public int getServerVersion()- Specified by:
getServerVersionin classSessionContext
-
addressQuery
- Specified by:
addressQueryin classSessionContext- Throws:
ActiveMQException
-
closeConsumer
- Specified by:
closeConsumerin classSessionContext- Throws:
ActiveMQException
-
sendConsumerCredits
- Specified by:
sendConsumerCreditsin classSessionContext
-
forceDelivery
- Specified by:
forceDeliveryin classSessionContext- Throws:
ActiveMQException
-
simpleCommit
- Specified by:
simpleCommitin classSessionContext- Throws:
ActiveMQException
-
simpleCommit
- Specified by:
simpleCommitin classSessionContext- Throws:
ActiveMQException
-
simpleRollback
Description copied from class:SessionContextIf 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.
- Specified by:
simpleRollbackin classSessionContext- Throws:
ActiveMQException
-
sessionStart
- Specified by:
sessionStartin classSessionContext- Throws:
ActiveMQException
-
sessionStop
- Specified by:
sessionStopin classSessionContext- Throws:
ActiveMQException
-
addSessionMetadata
- Specified by:
addSessionMetadatain classSessionContext- Throws:
ActiveMQException
-
addUniqueMetaData
- Specified by:
addUniqueMetaDatain classSessionContext- Throws:
ActiveMQException
-
xaCommit
- Specified by:
xaCommitin classSessionContext- Throws:
XAExceptionActiveMQException
-
xaEnd
- Specified by:
xaEndin classSessionContext- Throws:
XAExceptionActiveMQException
-
sendProducerCreditsMessage
- Specified by:
sendProducerCreditsMessagein classSessionContext
-
supportsLargeMessage
public boolean supportsLargeMessage()ActiveMQ Artemis does support large messages- Specified by:
supportsLargeMessagein classSessionContext
-
getCreditsOnSendingFull
- Specified by:
getCreditsOnSendingFullin classSessionContext
-
sendFullMessage
public void sendFullMessage(ICoreMessage msgI, boolean sendBlocking, SendAcknowledgementHandler handler, SimpleString defaultAddress, int senderID) throws ActiveMQException - Specified by:
sendFullMessagein classSessionContext- Throws:
ActiveMQException
-
sendInitialChunkOnLargeMessage
Description copied from class:SessionContextit should return the number of credits (or bytes) used to send this packet- Specified by:
sendInitialChunkOnLargeMessagein classSessionContext- Throws:
ActiveMQException
-
sendLargeMessageChunk
public int sendLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int reconnectID, int senderID, SendAcknowledgementHandler messageHandler) throws ActiveMQException - Specified by:
sendLargeMessageChunkin classSessionContext- Throws:
ActiveMQException
-
sendServerLargeMessageChunk
public int sendServerLargeMessageChunk(Message msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int senderID, SendAcknowledgementHandler messageHandler) throws ActiveMQException - Specified by:
sendServerLargeMessageChunkin classSessionContext- Throws:
ActiveMQException
-
sendACK
public void sendACK(boolean individual, boolean block, ClientConsumer consumer, Message message) throws ActiveMQException - Specified by:
sendACKin classSessionContext- Throws:
ActiveMQException
-
expireMessage
- Specified by:
expireMessagein classSessionContext- Throws:
ActiveMQException
-
sessionClose
- Specified by:
sessionClosein classSessionContext- Throws:
ActiveMQException
-
xaForget
- Specified by:
xaForgetin classSessionContext- Throws:
XAExceptionActiveMQException
-
xaPrepare
- Specified by:
xaPreparein classSessionContext- Throws:
XAExceptionActiveMQException
-
xaScan
- Specified by:
xaScanin classSessionContext- Throws:
ActiveMQException
-
xaRollback
- Specified by:
xaRollbackin classSessionContext- Throws:
ActiveMQExceptionXAException
-
xaStart
- Specified by:
xaStartin classSessionContext- Throws:
XAExceptionActiveMQException
-
configureTransactionTimeout
- Specified by:
configureTransactionTimeoutin classSessionContext- Throws:
ActiveMQException
-
recoverSessionTimeout
Description copied from class:SessionContextPerforms a round trip to the server requesting what is the current tx timeout on the session- Specified by:
recoverSessionTimeoutin classSessionContext- Throws:
ActiveMQException
-
createAddress
public void createAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException - Specified by:
createAddressin classSessionContext- Throws:
ActiveMQException
-
createAddress
public void createAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException - Specified by:
createAddressin classSessionContext- Throws:
ActiveMQException
-
createQueue
@Deprecated public void createQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, boolean autoCreated) throws ActiveMQException Deprecated.- Specified by:
createQueuein classSessionContext- Throws:
ActiveMQException
-
createQueue
@Deprecated public void createQueue(SimpleString address, SimpleString queueName, boolean temp, boolean autoCreated, QueueAttributes queueAttributes) throws ActiveMQException Deprecated.- Specified by:
createQueuein classSessionContext- Throws:
ActiveMQException
-
createQueue
@Deprecated public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated, Boolean exclusive, Boolean lastValue) throws ActiveMQException Deprecated.- Specified by:
createQueuein classSessionContext- Throws:
ActiveMQException
-
createQueue
@Deprecated public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated) throws ActiveMQException Deprecated.- Specified by:
createQueuein classSessionContext- Throws:
ActiveMQException
-
createQueue
- Specified by:
createQueuein classSessionContext- Throws:
ActiveMQException
-
transferConnection
Description copied from class:SessionContextTransfers the session context to the given newConnection on the client-side- Specified by:
transferConnectionin classSessionContext
-
reattachOnNewConnection
Description copied from class:SessionContextit will either reattach or reconnect, preferably reattaching it.- Specified by:
reattachOnNewConnectionin classSessionContext- Returns:
- true if it was possible to reattach
- Throws:
ActiveMQException
-
recreateSession
public void recreateSession(String username, String password, int minLargeMessageSize, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge) throws ActiveMQException - Specified by:
recreateSessionin classSessionContext- Throws:
ActiveMQException
-
newCreateSession
protected CreateSessionMessage newCreateSession(String username, String password, int minLargeMessageSize, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge) -
recreateConsumerOnServer
public void recreateConsumerOnServer(ClientConsumerInternal consumerInternal, long consumerId, boolean isSessionStarted) throws ActiveMQException - Specified by:
recreateConsumerOnServerin classSessionContext- Throws:
ActiveMQException
-
xaFailed
- Specified by:
xaFailedin classSessionContext- Throws:
ActiveMQException
-
restartSession
- Specified by:
restartSessionin classSessionContext- Throws:
ActiveMQException
-
resetMetadata
- Specified by:
resetMetadatain classSessionContext
-
getDefaultConsumerWindowSize
public int getDefaultConsumerWindowSize(SessionQueueQueryResponseMessage response) throws ActiveMQException - Specified by:
getDefaultConsumerWindowSizein classSessionContext- Throws:
ActiveMQException
-
handleReceiveProducerCredits
-
handleReceiveProducerFailCredits
-
handleReceiveSlowConsumerKillMessage
-
lookupTCCL
-
calcWindowSize
protected int calcWindowSize(int windowSize)
-