org.apache.activemq.artemis.spi.core.remoting

## 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 and Description
    --- | ---
    `protected org.apache.activemq.artemis.utils.IDGenerator` | `idGenerator`
    `protected RemotingConnection` | `remotingConnection`
    `protected SendAcknowledgementHandler` | `sendAckHandler`
    `protected org.apache.activemq.artemis.core.client.impl.ClientSessionInternal` | `session`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionContext(RemotingConnection remotingConnection)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract ClientSession.AddressQuery` | `addressQuery(SimpleString address)`
    `abstract void` | `addSessionMetadata(String key, String data)`
    `abstract void` | `addUniqueMetaData(String key, String data)`
    `abstract void` | `cleanup()`
    `abstract void` | `closeConsumer(ClientConsumer consumer)`
    `abstract boolean` | `configureTransactionTimeout(int seconds)`
    `abstract org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal` | `createConsumer(SimpleString queueName, SimpleString filterString, int windowSize, int maxRate, int ackBatchSize, boolean browseOnly, Executor executor, Executor flowControlExecutor)`
    `abstract void` | `createQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp)`
    `abstract void` | `createSharedQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable)`
    `abstract void` | `deleteQueue(SimpleString queueName)`
    `abstract void` | `expireMessage(ClientConsumer consumer, Message message)`
    `abstract void` | `forceDelivery(ClientConsumer consumer, long sequence)`
    `abstract int` | `getCreditsOnSendingFull(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI)`
    `abstract int` | `getReconnectID()`
    `RemotingConnection` | `getRemotingConnection()`
    `abstract int` | `getServerVersion()`
    `org.apache.activemq.artemis.core.client.impl.ClientSessionInternal` | `getSession()`
    `protected void` | `handleReceiveContinuation(ConsumerContext consumerID, byte[] chunk, int flowControlSize, boolean isContinues)`
    `protected void` | `handleReceiveLargeMessage(ConsumerContext consumerID, org.apache.activemq.artemis.core.client.impl.ClientLargeMessageInternal clientLargeMessage, long largeMessageSize)`
    `protected void` | `handleReceiveMessage(ConsumerContext consumerID, org.apache.activemq.artemis.core.client.impl.ClientMessageInternal message)`
    `protected void` | `handleReceiveProducerCredits(SimpleString address, int credits)`
    `protected void` | `handleReceiveProducerFailCredits(SimpleString address, int credits)`
    `abstract boolean` | `isWritable(ReadyListener callback)`
    `abstract void` | `linkFlowControl(SimpleString address, org.apache.activemq.artemis.core.client.impl.ClientProducerCreditsImpl clientProducerCredits)`
    `abstract void` | `lockCommunications()` it will lock the communication channel of the session avoiding anything to come while failover is happening.
    `abstract ClientSession.QueueQuery` | `queueQuery(SimpleString queueName)`
    `abstract boolean` | `reattachOnNewConnection(RemotingConnection newConnection)` it will eather reattach or reconnect, preferably reattaching it.
    `abstract int` | `recoverSessionTimeout()` Performs a round trip to the server requesting what is the current tx timeout on the session
    `abstract void` | `recreateConsumerOnServer(org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal consumerInternal)`
    `abstract void` | `recreateSession(String username, String password, int minLargeMessageSize, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge, SimpleString defaultAddress)`
    `abstract void` | `releaseCommunications()`
    `abstract void` | `resetMetadata(HashMap<String,String> metaDataToSend)`
    `abstract void` | `resetName(String name)`
    `abstract void` | `restartSession()`
    `abstract void` | `returnBlocking(ActiveMQException cause)` Interrupt and return any blocked calls
    `abstract void` | `sendACK(boolean individual, boolean block, ClientConsumer consumer, Message message)`
    `abstract void` | `sendConsumerCredits(ClientConsumer consumer, int credits)`
    `abstract void` | `sendFullMessage(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI, boolean sendBlocking, SendAcknowledgementHandler handler, SimpleString defaultAddress)`
    `abstract int` | `sendInitialChunkOnLargeMessage(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI)` it should return the number of credits (or bytes) used to send this packet
    `abstract int` | `sendLargeMessageChunk(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, int reconnectID, SendAcknowledgementHandler messageHandler)`
    `abstract void` | `sendProducerCreditsMessage(int credits, SimpleString address)`
    `abstract int` | `sendServerLargeMessageChunk(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI, long messageBodySize, boolean sendBlocking, boolean lastChunk, byte[] chunk, SendAcknowledgementHandler messageHandler)`
    `abstract void` | `sessionClose()`
    `abstract void` | `sessionStart()`
    `abstract void` | `sessionStop()`
    `abstract void` | `setSendAcknowledgementHandler(SendAcknowledgementHandler handler)`
    `void` | `setSession(org.apache.activemq.artemis.core.client.impl.ClientSessionInternal session)`
    `abstract void` | `simpleCommit()`
    `abstract void` | `simpleRollback(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 boolean` | `supportsLargeMessage()`
    `abstract void` | `xaCommit(Xid xid, boolean onePhase)`
    `abstract void` | `xaEnd(Xid xid, int flags)`
    `abstract void` | `xaFailed(Xid xid)`
    `abstract void` | `xaForget(Xid xid)`
    `abstract int` | `xaPrepare(Xid xid)`
    `abstract void` | `xaRollback(Xid xid, boolean wasStarted)`
    `abstract Xid[]` | `xaScan()`
    `abstract void` | `xaStart(Xid xid, int flags)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 org.apache.activemq.artemis.utils.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()

    - #### reattachOnNewConnection

          public abstract boolean reattachOnNewConnection(RemotingConnection newConnection)
                                                   throws ActiveMQException

      it will eather 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(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI)

    - #### sendFullMessage

          public abstract void sendFullMessage(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI,
                                               boolean sendBlocking,
                                               SendAcknowledgementHandler handler,
                                               SimpleString defaultAddress)
                                        throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### sendInitialChunkOnLargeMessage

          public abstract int sendInitialChunkOnLargeMessage(org.apache.activemq.artemis.core.message.impl.MessageInternal 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(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI,
                                                    long messageBodySize,
                                                    boolean sendBlocking,
                                                    boolean lastChunk,
                                                    byte[] chunk,
                                                    int reconnectID,
                                                    SendAcknowledgementHandler messageHandler)
                                             throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### sendServerLargeMessageChunk

          public abstract int sendServerLargeMessageChunk(org.apache.activemq.artemis.core.message.impl.MessageInternal msgI,
                                                          long messageBodySize,
                                                          boolean sendBlocking,
                                                          boolean lastChunk,
                                                          byte[] chunk,
                                                          SendAcknowledgementHandler messageHandler)
                                                   throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### setSendAcknowledgementHandler

          public abstract void setSendAcknowledgementHandler(SendAcknowledgementHandler handler)

    - #### createSharedQueue

          public abstract void createSharedQueue(SimpleString address,
                                                 SimpleString queueName,
                                                 SimpleString filterString,
                                                 boolean durable)
                                          throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### deleteQueue

          public abstract void deleteQueue(SimpleString queueName)
                                    throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### createQueue

          public abstract void createQueue(SimpleString address,
                                           SimpleString queueName,
                                           SimpleString filterString,
                                           boolean durable,
                                           boolean temp)
                                    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`

    - #### simpleRollback

          public abstract void simpleRollback(boolean lastMessageAsDelivered)
                                       throws ActiveMQException

      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.

      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:
        `XAException`
        `ActiveMQException`

    - #### xaEnd

          public abstract void xaEnd(Xid xid,
                                     int flags)
                              throws XAException,
                                     ActiveMQException

      Throws:
        `XAException`
        `ActiveMQException`

    - #### xaForget

          public abstract void xaForget(Xid xid)
                                 throws XAException,
                                        ActiveMQException

      Throws:
        `XAException`
        `ActiveMQException`

    - #### xaPrepare

          public abstract int xaPrepare(Xid xid)
                                 throws XAException,
                                        ActiveMQException

      Throws:
        `XAException`
        `ActiveMQException`

    - #### xaScan

          public abstract Xid[] xaScan()
                                throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### xaRollback

          public abstract void xaRollback(Xid xid,
                                          boolean wasStarted)
                                   throws ActiveMQException,
                                          XAException

      Throws:
        `ActiveMQException`
        `XAException`

    - #### xaStart

          public abstract void xaStart(Xid xid,
                                       int flags)
                                throws XAException,
                                       ActiveMQException

      Throws:
        `XAException`
        `ActiveMQException`

    - #### 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 windowSize,
                                                                                                             int maxRate,
                                                                                                             int ackBatchSize,
                                                                                                             boolean browseOnly,
                                                                                                             Executor executor,
                                                                                                             Executor flowControlExecutor)
                                                                                                      throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### recoverSessionTimeout

          public abstract int recoverSessionTimeout()
                                             throws ActiveMQException

      Performs 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,
                                               SimpleString defaultAddress)
                                        throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### recreateConsumerOnServer

          public abstract void recreateConsumerOnServer(org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal consumerInternal)
                                                 throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### xaFailed

          public abstract void xaFailed(Xid xid)
                                 throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### restartSession

          public abstract void restartSession()
                                       throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### resetMetadata

          public abstract void resetMetadata(HashMap<String,String> metaDataToSend)

    - #### 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.ClientProducerCreditsImpl clientProducerCredits)

    - #### isWritable

          public abstract boolean isWritable(ReadyListener callback)

Copyright © 2017. All rights reserved.