Class AMQPBridgeReceiverManager<E>

java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeReceiverManager<E>
Type Parameters:
E - Type of object stored in the demand tracking map.

public abstract class AMQPBridgeReceiverManager<E> extends Object
An abstract base for managing bridge receiver instances that holds the demand currently present for a bridged resource and the receiver that exists to service that demand. This object manages the state of the receiver and the various stages it can pass through during its lifetime. All interactions with the receiver tracking entry should occur under the lock of the parent manager instance and this manager will perform any asynchronous work with a lock held on the parent manager instance.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new bridge receiver manager instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDemand(E demand)
    Add new demand to the receiver manager which creates or sustains the receiver lifetime that this manager maintains.
    protected abstract AMQPBridgeReceiver
    Creates a new bridge receiver that this manager will monitor and maintain.
    void
    Forces demand for this manager instance meaning that a consumer will be maintained until the manager is shutdown.
    void
    removeDemand(E demand)
    Remove the given element from the tracked receiver demand.
    void
    An orderly shutdown of the bridge receiver which will perform a drain of link credit before closing the receiver to ensure that all in-flight messages and dispositions are processed before the link is detached.
    void
    An immediate close of the bridge receiver which does not drain link credit or wait for any pending operations to complete.
    protected abstract void
    An event point that a subclass can use to perform an initialization action whenever an entry is added to demand tracking.
    protected abstract void
    An event point that a subclass can use to perform a cleanup action whenever an entry is removed from demand tracking.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AMQPBridgeReceiverManager

      public AMQPBridgeReceiverManager(AMQPBridgeFromPolicyManager policyManager, AMQPBridgeReceiverConfiguration configuration)
      Create a new bridge receiver manager instance.
      Parameters:
      policyManager - The policy manager that created this instance.
      configuration - The configuration that was in force when the manager was created.
  • Method Details

    • createBridgeReceiver

      protected abstract AMQPBridgeReceiver createBridgeReceiver()
      Creates a new bridge receiver that this manager will monitor and maintain. The returned receiver should be in an initial state ready for this manager to initialize once it is fully configured.
      Returns:
      a newly create AMQPBridgeReceiver for use by this manager.
    • whenDemandTrackingEntryAdded

      protected abstract void whenDemandTrackingEntryAdded(E entry)
      An event point that a subclass can use to perform an initialization action whenever an entry is added to demand tracking.
      Parameters:
      entry - The entry that is being added to demand tracking.
    • whenDemandTrackingEntryRemoved

      protected abstract void whenDemandTrackingEntryRemoved(E entry)
      An event point that a subclass can use to perform a cleanup action whenever an entry is removed from demand tracking.
      Parameters:
      entry - The entry that is being removed from demand tracking.
    • shutdown

      public void shutdown()
      An orderly shutdown of the bridge receiver which will perform a drain of link credit before closing the receiver to ensure that all in-flight messages and dispositions are processed before the link is detached. The bridge manager should be calling this method with its lock held.
    • shutdownNow

      public void shutdownNow()
      An immediate close of the bridge receiver which does not drain link credit or wait for any pending operations to complete. The bridge manager should be calling this method with its lock held.
    • forceDemand

      public void forceDemand()
      Forces demand for this manager instance meaning that a consumer will be maintained until the manager is shutdown.
    • addDemand

      public void addDemand(E demand)
      Add new demand to the receiver manager which creates or sustains the receiver lifetime that this manager maintains. When the first element of demand is added a new receiver is attached and when the last unit of demand is removed the receiver will be closed. The bridge manager should be calling this method with its lock held.
      Parameters:
      demand - A new unit of demand to add to this receiver manager.
    • removeDemand

      public void removeDemand(E demand)
      Remove the given element from the tracked receiver demand. If the tracked demand reaches zero then the managed receiver should be closed and the manager awaits future demand to be added. The manager can opt to hold a stopped receiver open for some period of time to avoid spurious open and closes as demand is added and removed. The bridge manager should be calling this method with its lock held.
      Parameters:
      demand - The element of demand that should be removed from tracking.