Class AMQPFederationSenderController

java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederationSenderController
All Implemented Interfaces:
SenderController
Direct Known Subclasses:
AMQPFederationAddressSenderController, AMQPFederationQueueSenderController

public abstract class AMQPFederationSenderController extends Object implements SenderController
A base class abstract SenderController implementation for use by federation address and queue senders that provides some common functionality used between both.
  • Field Details

  • Constructor Details

  • Method Details

    • getRole

      public abstract AMQPFederationSenderController.Role getRole()
      Returns an enumeration describing the role of the sender controller implementation.
      Returns:
      an enumeration describing the role of the sender controller implementation
    • getMessagesSent

      public final long getMessagesSent()
    • getServer

      public final org.apache.activemq.artemis.core.server.ActiveMQServer getServer()
    • getSenderContext

      public final ProtonServerSenderContext getSenderContext()
    • getServerConsumer

      public final org.apache.activemq.artemis.core.server.ServerConsumer getServerConsumer()
    • getSessionContext

      public final AMQPSessionContext getSessionContext()
    • getSessionCallback

      public final AMQPSessionCallback getSessionCallback()
    • getFederation

      public final AMQPFederation getFederation()
    • getPolicyManager

      public final AMQPFederationRemotePolicyManager getPolicyManager()
    • init

      public final org.apache.activemq.artemis.core.server.ServerConsumer init(ProtonServerSenderContext senderContext) throws Exception
      Description copied from interface: SenderController
      Initialize sender controller state and handle open of AMQP sender resources
      Specified by:
      init in interface SenderController
      Parameters:
      senderContext - The sender context that is requesting controller initialization.
      Returns:
      a server consumer that has been initialize by the controller
      Throws:
      Exception - if an error occurs during initialization.
    • createServerConsumer

      protected abstract org.apache.activemq.artemis.core.server.ServerConsumer createServerConsumer(ProtonServerSenderContext senderContext) throws Exception
      The subclass must implement this and create an appropriately configured server consumer based on the properties of the AMQP link and the role of the implemented sender type.
      Parameters:
      senderContext - The server sender context that this controller was created for.
      Returns:
      a new ServerConsumer instance that will send messages to the remote peer
      Throws:
      Exception - if an error occurs while creating the server consumer.
    • close

      public final void close(boolean remoteClose) throws Exception
      Description copied from interface: SenderController
      Handle close of the sever sender AMQP resources either from remote link detach or local close usually due to connection drop.
      Specified by:
      close in interface SenderController
      Parameters:
      remoteClose - Indicates if the remote link detached the sender or local action closed it.
      Throws:
      Exception - if an error occurs during close.
    • handleLinkRemotelyClosed

      protected void handleLinkRemotelyClosed()
      Subclasses should react to link remote close by cleaning up any resources
    • close

      public final void close(org.apache.qpid.proton.amqp.transport.ErrorCondition error)
      Description copied from interface: SenderController
      Called when the sender is being locally closed due to some error or forced shutdown due to resource deletion etc. The default implementation of this API does nothing in response to this call.
      Specified by:
      close in interface SenderController
      Parameters:
      error - The error condition that triggered the close.
    • handleLinkLocallyClosed

      protected void handleLinkLocallyClosed(org.apache.qpid.proton.amqp.transport.ErrorCondition error)
      Subclasses should react to link local close by cleaning up resources.
      Parameters:
      error - The error that triggered the local close or null if no error.
    • selectOutgoingMessageWriter

      public final MessageWriter selectOutgoingMessageWriter(ProtonServerSenderContext sender, org.apache.activemq.artemis.core.server.MessageReference reference)
      Description copied from interface: SenderController
      Controller selects a outgoing delivery writer that will handle the encoding and writing of the target Message carried in the given MessageReference. The selection process should take into account how the message pre-processing will mutate the outgoing message.

      The default implementation performs no caching of writers and should be overridden in subclasses to reduce GC churn, the default version is suitable for tests.

      Specified by:
      selectOutgoingMessageWriter in interface SenderController
      Parameters:
      sender - The server sender that will make use of the returned delivery context.
      reference - The message that must be sent using an outgoing context
      Returns:
      an MessageWriter to use when sending the message in the reference
    • registerRemoteLinkClosedInterceptor

      protected final void registerRemoteLinkClosedInterceptor(org.apache.qpid.proton.engine.Sender protonSender)
    • getRoutingType

      protected static RoutingType getRoutingType(org.apache.qpid.proton.amqp.messaging.Source source)