Package org.apache.activemq.artemis.spi.core.protocol

## Interface SessionCallback

-     public interface SessionCallback

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `afterDelivery()` | This can be used to complete certain operations outside of the lock, like acks or other operations.
    `void` | `browserFinished​(org.apache.activemq.artemis.core.server.ServerConsumer consumer)` | Some protocols (Openwire) needs a special message with the browser is finished.
    `default void` | `close​(boolean failed)` |
    `void` | `closed()` |
    `void` | `disconnect​(org.apache.activemq.artemis.core.server.ServerConsumer consumerId, org.apache.activemq.artemis.api.core.SimpleString queueName)` |
    `default org.apache.activemq.artemis.core.transaction.Transaction` | `getCurrentTransaction()` |
    `boolean` | `hasCredits​(org.apache.activemq.artemis.core.server.ServerConsumer consumerID)` | This one gives a chance for Proton to have its own flow control.
    `boolean` | `isWritable​(ReadyListener callback, java.lang.Object protocolContext)` |
    `int` | `sendLargeMessage​(org.apache.activemq.artemis.core.server.MessageReference reference, Message message, org.apache.activemq.artemis.core.server.ServerConsumer consumerID, long bodySize, int deliveryCount)` |
    `int` | `sendLargeMessageContinuation​(org.apache.activemq.artemis.core.server.ServerConsumer consumerID, byte[] body, boolean continues, boolean requiresResponse)` |
    `int` | `sendMessage​(org.apache.activemq.artemis.core.server.MessageReference ref, Message message, org.apache.activemq.artemis.core.server.ServerConsumer consumerID, int deliveryCount)` |
    `void` | `sendProducerCreditsFailMessage​(int credits, org.apache.activemq.artemis.api.core.SimpleString address)` |
    `void` | `sendProducerCreditsMessage​(int credits, org.apache.activemq.artemis.api.core.SimpleString address)` |
    `default boolean` | `supportsDirectDelivery()` | A requirement to do direct delivery is: no extra locking required at the protocol layer.
    `boolean` | `updateDeliveryCountAfterCancel​(org.apache.activemq.artemis.core.server.ServerConsumer consumer, org.apache.activemq.artemis.core.server.MessageReference ref, boolean failed)` | Use this to updates specifics on the message after a redelivery happened.

- - ### Method Detail

    - #### supportsDirectDelivery

          default boolean supportsDirectDelivery()

      A requirement to do direct delivery is: no extra locking required at the protocol layer. which cannot be guaranteed at AMQP as proton will need the locking. So, disable this on AMQP or any other protocol requiring extra lock.
      Returns:

    - #### hasCredits

          boolean hasCredits​(org.apache.activemq.artemis.core.server.ServerConsumer consumerID)

      This one gives a chance for Proton to have its own flow control.

    - #### afterDelivery

          void afterDelivery()
                      throws java.lang.Exception

      This can be used to complete certain operations outside of the lock, like acks or other operations.
      Throws:
        `java.lang.Exception`

    - #### updateDeliveryCountAfterCancel

          boolean updateDeliveryCountAfterCancel​(org.apache.activemq.artemis.core.server.ServerConsumer consumer,
                                                 org.apache.activemq.artemis.core.server.MessageReference ref,
                                                 boolean failed)

      Use this to updates specifics on the message after a redelivery happened. Return true if there was specific logic applied on the protocol, so the ServerConsumer won't make any adjustments.
      Parameters:
        `consumer` -
        `ref` -
        `failed` -

    - #### sendProducerCreditsMessage

          void sendProducerCreditsMessage​(int credits,
                                          org.apache.activemq.artemis.api.core.SimpleString address)

    - #### sendProducerCreditsFailMessage

          void sendProducerCreditsFailMessage​(int credits,
                                              org.apache.activemq.artemis.api.core.SimpleString address)

    - #### sendMessage

          int sendMessage​(org.apache.activemq.artemis.core.server.MessageReference ref,
                          Message message,
                          org.apache.activemq.artemis.core.server.ServerConsumer consumerID,
                          int deliveryCount)

    - #### sendLargeMessage

          int sendLargeMessage​(org.apache.activemq.artemis.core.server.MessageReference reference,
                               Message message,
                               org.apache.activemq.artemis.core.server.ServerConsumer consumerID,
                               long bodySize,
                               int deliveryCount)

    - #### sendLargeMessageContinuation

          int sendLargeMessageContinuation​(org.apache.activemq.artemis.core.server.ServerConsumer consumerID,
                                           byte[] body,
                                           boolean continues,
                                           boolean requiresResponse)

    - #### closed

          void closed()

    - #### disconnect

          void disconnect​(org.apache.activemq.artemis.core.server.ServerConsumer consumerId,
                          org.apache.activemq.artemis.api.core.SimpleString queueName)

    - #### isWritable

          boolean isWritable​(ReadyListener callback,
                             java.lang.Object protocolContext)

    - #### browserFinished

          void browserFinished​(org.apache.activemq.artemis.core.server.ServerConsumer consumer)

      Some protocols (Openwire) needs a special message with the browser is finished.

    - #### close

          default void close​(boolean failed)

    - #### getCurrentTransaction

          default org.apache.activemq.artemis.core.transaction.Transaction getCurrentTransaction()