Class AMQPFederationLocalPolicyManager
java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederationPolicyManager
org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederationLocalPolicyManager
- All Implemented Interfaces:
ActiveMQServerBasePlugin, ActiveMQServerBindingPlugin
- Direct Known Subclasses:
AMQPFederationAddressPolicyManager, AMQPFederationQueuePolicyManager
public abstract class AMQPFederationLocalPolicyManager
extends AMQPFederationPolicyManager
implements ActiveMQServerBindingPlugin
A federation policy manager for policies that operate on the local side of this broker connection. These policies
will create consumers on the remote which federate message back to this broker instance.
-
Nested Class Summary
Nested classes/interfaces inherited from class AMQPFederationPolicyManager
AMQPFederationPolicyManager.State -
Field Summary
FieldsFields inherited from class AMQPFederationPolicyManager
connected, federation, metrics, policyName, policyType, server, session, state -
Constructor Summary
ConstructorsConstructorDescriptionAMQPFederationLocalPolicyManager(AMQPFederation federation, AMQPFederationMetrics metrics, FederationReceiveFromResourcePolicy policy) -
Method Summary
Modifier and TypeMethodDescriptionprotected AMQPFederationConsumerConfigurationReturns the active configuration at this time the method is called.abstract FederationReceiveFromResourcePolicyReturns the immutable federation policy configuration that backs this manager.protected final voidOn connection interrupted a federation policy manager needs to perform any specific actions to pause of cleanup current resources based on the connection being closed.protected final voidOn connection restoration a federation policy manager needs to perform any specific actions to resume service based on a new connection having been established.protected final voidOn initialize a federation policy manager needs to perform any specific initialization actions it requires to begin tracking broker resources.protected final voidOn shutdown a federation policy manager needs to perform any specific shutdown actions it requires to cease tracking broker resources.protected final voidOn start a federation policy manager needs to perform any specific startup actions it requires to begin tracking broker resources.protected final voidOn stop a federation policy manager needs to perform any specific stopped actions it requires to cease tracking broker resources and cleanup.protected final booleanisPluginBlockingFederationConsumerCreate(org.apache.activemq.artemis.core.server.Divert divert, org.apache.activemq.artemis.core.server.Queue queue) Query all registered plugins for this federation instance to determine if any wish to prevent a federation consumer from being created for the given Queue.protected final booleanisPluginBlockingFederationConsumerCreate(org.apache.activemq.artemis.core.server.impl.AddressInfo address) Query all registered plugins for this federation instance to determine if any wish to prevent a federation consumer from being created for the given resource.protected final booleanisPluginBlockingFederationConsumerCreate(org.apache.activemq.artemis.core.server.Queue queue) Query all registered plugins for this federation instance to determine if any wish to prevent a federation consumer from being created for the given Queue.protected abstract voidsafeCleanupManagerResources(boolean force) The subclass implements this method and should remove all tracked federation consumer data and also close all consumers either by first safely stopping the consumer or if offline simply closing the consumer.protected abstract voidScans all bindings and push them through the normal bindings checks that would be done on an add.protected final voidSignal any registered plugins for this federation instance that a remote consumer has now been closed.protected final voidSignal any registered plugins for this federation instance that a remote consumer has been created.protected final voidSignal any registered plugins for this federation instance that a remote consumer is about to be closed.protected final voidSignal any registered plugins for this federation instance that a remote consumer is being created.protected voidtryCloseFederationConsumer(AMQPFederationConsumer federationConsuner) Attempts to close a federation consumer and signals the installed federation plugin of the impending and post closed state.protected abstract voidupdateStateAfterConnect(AMQPFederationConsumerConfiguration configuration, AMQPSessionContext session) Allows the policy manager implementation to update internal state after (re)connection and before the policy manager triggers a scan of all bindings to check for existing or new demand.Methods inherited from class AMQPFederationPolicyManager
connectionInterrupted, connectionRestored, failIfShutdown, getFederation, getMetrics, getPolicyName, getPolicyType, initialize, isActive, isConnected, isStarted, shutdown, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ActiveMQServerBasePlugin
init, registered, setInit, unregisteredMethods inherited from interface ActiveMQServerBindingPlugin
afterAddBinding, afterRemoveBinding, beforeAddBinding, beforeRemoveBinding
-
Field Details
-
configuration
-
-
Constructor Details
-
AMQPFederationLocalPolicyManager
public AMQPFederationLocalPolicyManager(AMQPFederation federation, AMQPFederationMetrics metrics, FederationReceiveFromResourcePolicy policy) throws ActiveMQException - Throws:
ActiveMQException
-
-
Method Details
-
getPolicy
Returns the immutable federation policy configuration that backs this manager.- Returns:
- the immutable federation policy configuration that backs this manager
-
getConfiguration
Returns the active configuration at this time the method is called.- Returns:
- the active configuration at this time the method is called
-
handleManagerInitialized
protected final void handleManagerInitialized()Description copied from class:AMQPFederationPolicyManagerOn initialize a federation policy manager needs to perform any specific initialization actions it requires to begin tracking broker resources.- Specified by:
handleManagerInitializedin classAMQPFederationPolicyManager
-
handleManagerStarted
protected final void handleManagerStarted()Description copied from class:AMQPFederationPolicyManagerOn start a federation policy manager needs to perform any specific startup actions it requires to begin tracking broker resources.- Specified by:
handleManagerStartedin classAMQPFederationPolicyManager
-
handleManagerStopped
protected final void handleManagerStopped()Description copied from class:AMQPFederationPolicyManagerOn stop a federation policy manager needs to perform any specific stopped actions it requires to cease tracking broker resources and cleanup.- Specified by:
handleManagerStoppedin classAMQPFederationPolicyManager
-
handleManagerShutdown
protected final void handleManagerShutdown()Description copied from class:AMQPFederationPolicyManagerOn shutdown a federation policy manager needs to perform any specific shutdown actions it requires to cease tracking broker resources.- Specified by:
handleManagerShutdownin classAMQPFederationPolicyManager
-
handleConnectionInterrupted
protected final void handleConnectionInterrupted()Description copied from class:AMQPFederationPolicyManagerOn connection interrupted a federation policy manager needs to perform any specific actions to pause of cleanup current resources based on the connection being closed.- Specified by:
handleConnectionInterruptedin classAMQPFederationPolicyManager
-
handleConnectionRestored
protected final void handleConnectionRestored()Description copied from class:AMQPFederationPolicyManagerOn connection restoration a federation policy manager needs to perform any specific actions to resume service based on a new connection having been established.- Specified by:
handleConnectionRestoredin classAMQPFederationPolicyManager
-
updateStateAfterConnect
protected abstract void updateStateAfterConnect(AMQPFederationConsumerConfiguration configuration, AMQPSessionContext session) Allows the policy manager implementation to update internal state after (re)connection and before the policy manager triggers a scan of all bindings to check for existing or new demand.- Parameters:
configuration- The updated configuration based on the current connection.session- The session that matches the current connection.
-
scanAllBindings
protected abstract void scanAllBindings()Scans all bindings and push them through the normal bindings checks that would be done on an add. This allows for checks on demand after a start or after a connection is restored. -
safeCleanupManagerResources
protected abstract void safeCleanupManagerResources(boolean force) The subclass implements this method and should remove all tracked federation consumer data and also close all consumers either by first safely stopping the consumer or if offline simply closing the consumer. If the force flag is set to true the implementation should close the consumer without attempting to stop it by draining link credit before the close.- Parameters:
force- Should the implementation simply close the consumers without attempting a stop.
-
tryCloseFederationConsumer
Attempts to close a federation consumer and signals the installed federation plugin of the impending and post closed state. The method will not double close a consumer as it checks the closed state. The method is synchronized to allow for use in asynchronous call backs from federation consumers.- Parameters:
federationConsuner- A federation consumer to close, or null in which case no action is taken.
-
signalPluginBeforeCreateFederationConsumer
Signal any registered plugins for this federation instance that a remote consumer is being created.- Parameters:
info- TheFederationConsumerInfothat describes the remote federation consumer
-
signalPluginAfterCreateFederationConsumer
Signal any registered plugins for this federation instance that a remote consumer has been created.- Parameters:
consumer- TheFederationConsumerInfothat describes the remote consumer
-
signalPluginBeforeCloseFederationConsumer
Signal any registered plugins for this federation instance that a remote consumer is about to be closed.- Parameters:
consumer- TheFederationConsumerthat that is about to be closed.
-
signalPluginAfterCloseFederationConsumer
Signal any registered plugins for this federation instance that a remote consumer has now been closed.- Parameters:
consumer- TheFederationConsumerthat that has been closed.
-
isPluginBlockingFederationConsumerCreate
protected final boolean isPluginBlockingFederationConsumerCreate(org.apache.activemq.artemis.core.server.impl.AddressInfo address) Query all registered plugins for this federation instance to determine if any wish to prevent a federation consumer from being created for the given resource.- Parameters:
address- The address on which the manager is intending to create a remote consumer for.- Returns:
- true if any registered plugin signaled that creation should be suppressed
-
isPluginBlockingFederationConsumerCreate
protected final boolean isPluginBlockingFederationConsumerCreate(org.apache.activemq.artemis.core.server.Divert divert, org.apache.activemq.artemis.core.server.Queue queue) Query all registered plugins for this federation instance to determine if any wish to prevent a federation consumer from being created for the given Queue.- Parameters:
divert- TheDivertthat triggered the manager to attempt to create a remote consumer.queue- TheQueuethat triggered the manager to attempt to create a remote consumer.- Returns:
- true if any registered plugin signaled that creation should be suppressed
-
isPluginBlockingFederationConsumerCreate
protected final boolean isPluginBlockingFederationConsumerCreate(org.apache.activemq.artemis.core.server.Queue queue) Query all registered plugins for this federation instance to determine if any wish to prevent a federation consumer from being created for the given Queue.- Parameters:
queue- TheQueuethat triggered the manager to attempt to create a remote consumer.- Returns:
- true if any registered plugin signaled that creation should be suppressed
-