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.
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 ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescriptionAMQPBridgeReceiverManager(AMQPBridgeFromPolicyManager policyManager, AMQPBridgeReceiverConfiguration configuration) Create a new bridge receiver manager instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd new demand to the receiver manager which creates or sustains the receiver lifetime that this manager maintains.protected abstract AMQPBridgeReceiverCreates a new bridge receiver that this manager will monitor and maintain.voidForces demand for this manager instance meaning that a consumer will be maintained until the manager is shutdown.voidremoveDemand(E demand) Remove the given element from the tracked receiver demand.voidshutdown()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.voidAn immediate close of the bridge receiver which does not drain link credit or wait for any pending operations to complete.protected abstract voidwhenDemandTrackingEntryAdded(E entry) An event point that a subclass can use to perform an initialization action whenever an entry is added to demand tracking.protected abstract voidwhenDemandTrackingEntryRemoved(E entry) An event point that a subclass can use to perform a cleanup action whenever an entry is removed from demand tracking.
-
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
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
AMQPBridgeReceiverfor use by this manager.
-
whenDemandTrackingEntryAdded
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
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
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
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.
-