Class AMQPBridgePolicyManager

java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgePolicyManager
Direct Known Subclasses:
AMQPBridgeFromPolicyManager, AMQPBridgeToPolicyManager

public abstract class AMQPBridgePolicyManager extends Object
Base API for a bridged resource policy manager.
  • Field Details

  • Constructor Details

  • Method Details

    • isStarted

      public final boolean isStarted()
      Returns true if the policy is started at the time this method was called.
      Returns:
      true if the policy is started at the time this method was called
    • isConnected

      protected final boolean isConnected()
      Returns if the policy manager has been marked as connected to the remote peer. This method must be called under lock to ensure the returned state is accurate.
      Returns:
      the state of the connected flag based on the last update from the connection APIs
    • getBridgeManager

      public AMQPBridgeManager getBridgeManager()
      Returns the AMQPBridgeManager that owns this send to policy manager.
      Returns:
      the AMQPBridgeManager that owns this send to policy manager
    • getMetrics

      public AMQPBridgeMetrics getMetrics()
      Returns the metrics instance tied to this bridge policy manager instance.
      Returns:
      the metrics instance tied to this bridge policy manager instance
    • getPolicy

      public abstract AMQPBridgePolicy getPolicy()
      Returns the AMQPBridgePolicy that configured this policy manager.
      Returns:
      the AMQPBridgePolicy that configured this policy manager
    • getPolicyType

      public final AMQPBridgeType getPolicyType()
      Returns the bridge type this policy manager implements.
      Returns:
      the bridge type this policy manager implements
    • getPolicyName

      public final String getPolicyName()
      Returns the assigned name of the policy that is being managed.
      Returns:
      the assigned name of the policy that is being managed
    • initialize

      public final void initialize()
      Initialize the bridge policy manager creating any resource needed and registering any services offered.
    • start

      public final void start()
      Start the bridge policy manager which will initiate a scan of all broker bindings and create and matching remote senders or receivers. Start on a policy manager should only be called after its parent AMQPBridgeManager is started and the bridge connection has been established.
    • stop

      public final void stop()
      Stops the bridge policy manager which will close any open remote senders or receivers that are active for local queue demand. Stop should generally be called whenever the parent AMQPBridgeManager loses its connection to the remote.
    • shutdown

      public final void shutdown()
      Shutdown the manager and cleanup any in use resources.
    • connectionInterrupted

      public final void connectionInterrupted()
      Called by the parent AMQP bridge manager when the connection has failed and this AMQP policy manager should tear down any active resources and await a reconnect if one is allowed.
    • connectionRestored

      public final void connectionRestored(AMQPSessionContext session, AMQPBridgeConfiguration configuration)
      Called by the parent AMQP bridge manager when the connection has been established and this AMQP policy manager should build up its active state based on the configuration. If not started when a connection is established the policy manager services should remain stopped.
      Parameters:
      session - The new Session that was created for use by broker connection resources.
      configuration - The bridge configuration that hold state relative to the new active connection.
    • failIfShutdown

      protected final void failIfShutdown() throws IllegalStateException
      Checks if shut down already and throws an IllegalStateException if so.
      Throws:
      IllegalStateException
    • isActive

      protected final boolean isActive()
      Returns true if the policy manager is both started and marked as connected to the remote peer. This method must always be called under lock to ensure the state returned is accurate.
      Returns:
      true if the manager is both started and the connected state is true
    • handleManagerInitialized

      protected abstract void handleManagerInitialized()
      On initialize a bridge policy manager needs to perform any specific initialization actions it requires to begin tracking broker resources.
    • handleManagerStarted

      protected abstract void handleManagerStarted()
      On start a bridge policy manager needs to perform any specific startup actions it requires to begin tracking broker resources.
    • handleManagerStopped

      protected abstract void handleManagerStopped()
      On stop a bridge policy manager needs to perform any specific stopped actions it requires to cease tracking broker resources and cleanup.
    • handleManagerShutdown

      protected abstract void handleManagerShutdown()
      On shutdown a bridge policy manager needs to perform any specific shutdown actions it requires to cease tracking broker resources.
    • handleConnectionInterrupted

      protected abstract void handleConnectionInterrupted()
      On connection interrupted a bridge policy manager needs to perform any specific actions to pause of cleanup current resources based on the connection being closed.
    • handleConnectionRestored

      protected abstract void handleConnectionRestored(AMQPBridgeConfiguration configuration)
      On connection restoration a bridge policy manager needs to perform any specific actions to resume service based on a new connection having been established.
      Parameters:
      configuration - The bridge configuration relative to the currently established connection.