Class AMQPBridgePolicyManager
java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgePolicyManager
- Direct Known Subclasses:
AMQPBridgeFromPolicyManager, AMQPBridgeToPolicyManager
Base API for a bridged resource policy manager.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AMQPBridgeManagerprotected booleanprotected final AMQPBridgeMetricsprotected final Stringprotected final AMQPBridgeTypeprotected final org.apache.activemq.artemis.core.server.ActiveMQServerprotected AMQPSessionContextprotected AMQPBridgePolicyManager.State -
Constructor Summary
ConstructorsConstructorDescriptionAMQPBridgePolicyManager(AMQPBridgeManager bridge, AMQPBridgeMetrics metrics, String policyName, AMQPBridgeType policyType) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidCalled 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.final voidconnectionRestored(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.protected final voidChecks if shut down already and throws anIllegalStateExceptionif so.Returns theAMQPBridgeManagerthat owns this send to policy manager.Returns the metrics instance tied to this bridge policy manager instance.abstract AMQPBridgePolicyReturns theAMQPBridgePolicythat configured this policy manager.final StringReturns the assigned name of the policy that is being managed.final AMQPBridgeTypeReturns the bridge type this policy manager implements.protected abstract voidOn connection interrupted a bridge policy manager needs to perform any specific actions to pause of cleanup current resources based on the connection being closed.protected abstract voidhandleConnectionRestored(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.protected abstract voidOn initialize a bridge policy manager needs to perform any specific initialization actions it requires to begin tracking broker resources.protected abstract voidOn shutdown a bridge policy manager needs to perform any specific shutdown actions it requires to cease tracking broker resources.protected abstract voidOn start a bridge policy manager needs to perform any specific startup actions it requires to begin tracking broker resources.protected abstract voidOn stop a bridge policy manager needs to perform any specific stopped actions it requires to cease tracking broker resources and cleanup.final voidInitialize the bridge policy manager creating any resource needed and registering any services offered.protected final booleanisActive()Returnstrueif the policy manager is both started and marked as connected to the remote peer.protected final booleanReturns if the policy manager has been marked as connected to the remote peer.final booleanReturnstrueif the policy is started at the time this method was called.final voidshutdown()Shutdown the manager and cleanup any in use resources.final voidstart()Start the bridge policy manager which will initiate a scan of all broker bindings and create and matching remote senders or receivers.final voidstop()Stops the bridge policy manager which will close any open remote senders or receivers that are active for local queue demand.
-
Field Details
-
metrics
-
server
protected final org.apache.activemq.artemis.core.server.ActiveMQServer server -
bridge
-
policyName
-
policyType
-
state
-
connected
protected boolean connected -
session
-
-
Constructor Details
-
AMQPBridgePolicyManager
public AMQPBridgePolicyManager(AMQPBridgeManager bridge, AMQPBridgeMetrics metrics, String policyName, AMQPBridgeType policyType)
-
-
Method Details
-
isStarted
public final boolean isStarted()Returnstrueif the policy is started at the time this method was called.- Returns:
trueif 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
Returns theAMQPBridgeManagerthat owns this send to policy manager.- Returns:
- the
AMQPBridgeManagerthat owns this send to policy manager
-
getMetrics
Returns the metrics instance tied to this bridge policy manager instance.- Returns:
- the metrics instance tied to this bridge policy manager instance
-
getPolicy
Returns theAMQPBridgePolicythat configured this policy manager.- Returns:
- the
AMQPBridgePolicythat configured this policy manager
-
getPolicyType
Returns the bridge type this policy manager implements.- Returns:
- the bridge type this policy manager implements
-
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 parentAMQPBridgeManageris 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 parentAMQPBridgeManagerloses 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 newSessionthat was created for use by broker connection resources.configuration- The bridge configuration that hold state relative to the new active connection.
-
failIfShutdown
Checks if shut down already and throws anIllegalStateExceptionif so.- Throws:
IllegalStateException
-
isActive
protected final boolean isActive()Returnstrueif 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:
trueif the manager is both started and the connected state istrue
-
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
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.
-