Class AMQPFederation
java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederation
- All Implemented Interfaces:
Federation
- Direct Known Subclasses:
AMQPFederationSource, AMQPFederationTarget
A single AMQP Federation instance that can be tied to an AMQP broker connection or used on a remote peer to control
the reverse case of when the remote configures the target side of the connection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected AMQPConnectionContextprotected AMQPFederationEventDispatcherprotected AMQPFederationEventProcessorstatic final StringValue used to store the federation instance used by an AMQP connection that is performing remote command and control operations or is the target of said operations.protected final Map<String, AMQPFederationAddressPolicyManager> protected final Map<String, AMQPFederationQueuePolicyManager> protected final AMQPFederationMetricsprotected final Stringprotected final Map<String, AMQPFederationRemoteAddressPolicyManager> protected final Map<String, AMQPFederationRemoteQueuePolicyManager> protected final ScheduledExecutorServiceprotected final org.apache.activemq.artemis.core.server.ActiveMQServerprotected AMQPSessionContextprotected org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederation.Stateprotected final WildcardConfiguration -
Constructor Summary
ConstructorsConstructorDescriptionAMQPFederation(String name, org.apache.activemq.artemis.core.server.ActiveMQServer server) -
Method Summary
Modifier and TypeMethodDescriptionaddAddressMatchPolicy(FederationReceiveFromAddressPolicy addressPolicy) Adds a newFederationReceiveFromAddressPolicyentry to the set of policies that this federation will use to create demand on the remote when local demand is present.addLinkClosedInterceptor(String id, Predicate<org.apache.qpid.proton.engine.Link> interceptor) Adds a remote linked closed event interceptor that can intercept the closed event and if it returns true indicate that the close has been handled and that no further action need to be taken for this event.addQueueMatchPolicy(FederationReceiveFromQueuePolicy queuePolicy) Adds a newFederationReceiveFromQueuePolicyentry to the set of policies that this federation will use to create demand on the remote when local demand is present.abstract AMQPFederationCapabilitiesReturns the federation capabilities that is in effect following negotiation.abstract AMQPFederationConfigurationReturns the federation configuration that is in effect.abstract AMQPConnectionContextReturns the session context assigned to this federation instance.Returns the metrics instance tied to this federation instance.getName()Returns the unique name that was assigned to this server federation connector.getRemoteAddressPolicyManager(String policyName) Gets the remote federation address policy manager assigned to the given name, if none is yet managed by this federation instance a new manager is created and added to this managers tracking state for remote policy managers.getRemoteQueuePolicyManager(String policyName) Gets the remote federation queue policy manager assigned to the given name, if none is yet managed by this federation instance a new manager is created and added to this managers tracking state for remote policy managers.org.apache.activemq.artemis.core.server.ActiveMQServerReturns theActiveMQServerinstance assigned to thisFederation.abstract AMQPSessionContextReturns the session context assigned to this federation instance.Returns theWildcardConfigurationthat is in use by this server federation.protected voidProvides an entry point for the concrete federation implementation to respond to being initialized.protected voidProvides an entry point for the concrete federation implementation to respond to being shutdown.protected voidProvides an entry point for the concrete federation implementation to respond to being started.protected voidProvides an entry point for the concrete federation implementation to respond to being stopped.final voidInitialize this federation instance if not already initialized.protected final booleaninvokeLinkClosedInterceptors(org.apache.qpid.proton.engine.Link link) booleanReturnstrueif the federation has been marked as connected.booleanReturns is this federation instance started (may not be connected yet).Remove a previously registered link close interceptor from the list of close interceptor bindings.final voidshutdown()Shutdown this federation instance if not already shutdown (this is a terminal operation).protected abstract voidsignalError(Exception cause) Error signaling API that must be implemented by the specific federation implementation to handle errors encountered during normal operations.protected final voidprotected final voidprotected abstract voidError signaling API that must be implemented by the specific federation implementation to handle error when creating a federation resource such as an outgoing receiver link.final voidstart()Starts this federation instance if not already started.final voidstop()Stops this federation instance and shuts down all remote resources that the federation currently has open and active.
-
Field Details
-
FEDERATION_INSTANCE_RECORD
Value used to store the federation instance used by an AMQP connection that is performing remote command and control operations or is the target of said operations. Only one federation instance is allowed per connection and will be checked.- See Also:
-
localQueuePolicyManagers
-
localAddressPolicyManagers
-
linkClosedinterceptors
-
remoteAddressPolicyManagers
-
remoteQueuePolicyManagers
-
wildcardConfiguration
-
scheduler
-
name
-
server
protected final org.apache.activemq.artemis.core.server.ActiveMQServer server -
metrics
-
eventDispatcher
-
eventProcessor
-
connection
-
session
-
state
protected volatile org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederation.State state -
connected
protected volatile boolean connected
-
-
Constructor Details
-
AMQPFederation
-
-
Method Details
-
getWildcardConfiguration
Returns theWildcardConfigurationthat is in use by this server federation.- Returns:
- the
WildcardConfigurationthat is in use by this server federation
-
getScheduler
-
getServer
public org.apache.activemq.artemis.core.server.ActiveMQServer getServer()Description copied from interface:FederationReturns theActiveMQServerinstance assigned to thisFederation.- Specified by:
getServerin interfaceFederation- Returns:
- the
ActiveMQServerinstance assigned to thisFederation
-
getMetrics
Returns the metrics instance tied to this federation instance.- Returns:
- the metrics instance tied to this federation instance
-
getName
Description copied from interface:FederationReturns the unique name that was assigned to this server federation connector.- Specified by:
getNamein interfaceFederation- Returns:
- the unique name that was assigned to this server federation connector
-
isStarted
public boolean isStarted()Description copied from interface:FederationReturns is this federation instance started (may not be connected yet).- Specified by:
isStartedin interfaceFederation- Returns:
- is this federation instance started (may not be connected yet)
-
isConnected
public boolean isConnected()Returnstrueif the federation has been marked as connected.- Returns:
trueif the federation has been marked as connected
-
getConnectionContext
Returns the session context assigned to this federation instance.- Returns:
- the session context assigned to this federation instance
-
getSessionContext
Returns the session context assigned to this federation instance.- Returns:
- the session context assigned to this federation instance
-
getConfiguration
Returns the federation configuration that is in effect.- Returns:
- the federation configuration that is in effect
-
getCapabilities
Returns the federation capabilities that is in effect following negotiation.- Returns:
- the federation capabilities that is in effect following negotiation
-
initialize
Initialize this federation instance if not already initialized.- Throws:
ActiveMQException- if an error occurs during the initialization process.
-
start
Starts this federation instance if not already started.- Throws:
ActiveMQException- if an error occurs during the start process.
-
stop
Stops this federation instance and shuts down all remote resources that the federation currently has open and active.- Throws:
ActiveMQException- if an error occurs during the stop process.
-
shutdown
Shutdown this federation instance if not already shutdown (this is a terminal operation).- Throws:
ActiveMQException- if an error occurs during the shutdown process.
-
addLinkClosedInterceptor
public AMQPFederation addLinkClosedInterceptor(String id, Predicate<org.apache.qpid.proton.engine.Link> interceptor) Adds a remote linked closed event interceptor that can intercept the closed event and if it returns true indicate that the close has been handled and that no further action need to be taken for this event.- Parameters:
id- A unique Id value that identifies the interceptor for later removal.interceptor- The predicate that will be called for any link close.- Returns:
- this
AMQPFederationinstance
-
removeLinkClosedInterceptor
Remove a previously registered link close interceptor from the list of close interceptor bindings.- Parameters:
id- The id of the interceptor to remove- Returns:
- this
AMQPFederationinstance
-
addQueueMatchPolicy
public AMQPFederation addQueueMatchPolicy(FederationReceiveFromQueuePolicy queuePolicy) throws ActiveMQException Adds a newFederationReceiveFromQueuePolicyentry to the set of policies that this federation will use to create demand on the remote when local demand is present.- Parameters:
queuePolicy- The policy to add to the set of configuredFederationReceiveFromQueuePolicyinstance.- Returns:
- this
AMQPFederationinstance - Throws:
ActiveMQException- if an error occurs processing the added policy
-
addAddressMatchPolicy
public AMQPFederation addAddressMatchPolicy(FederationReceiveFromAddressPolicy addressPolicy) throws ActiveMQException Adds a newFederationReceiveFromAddressPolicyentry to the set of policies that this federation will use to create demand on the remote when local demand is present.- Parameters:
addressPolicy- The policy to add to the set of configuredFederationReceiveFromAddressPolicyinstance.- Returns:
- this
AMQPFederationinstance - Throws:
ActiveMQException- if an error occurs processing the added policy
-
getRemoteAddressPolicyManager
Gets the remote federation address policy manager assigned to the given name, if none is yet managed by this federation instance a new manager is created and added to this managers tracking state for remote policy managers.- Parameters:
policyName- The name of the policy whose manager is being queried for.- Returns:
- an
AMQPFederationRemoteAddressPolicyManagerthat matches the given name and type
-
getRemoteQueuePolicyManager
Gets the remote federation queue policy manager assigned to the given name, if none is yet managed by this federation instance a new manager is created and added to this managers tracking state for remote policy managers.- Parameters:
policyName- The name of the policy whose manager is being queried for.- Returns:
- an
AMQPFederationRemoteQueuePolicyManagerthat matches the given name and type
-
signalResourceCreateError
Error signaling API that must be implemented by the specific federation implementation to handle error when creating a federation resource such as an outgoing receiver link.- Parameters:
cause- The error that caused the resource creation to fail.
-
signalError
Error signaling API that must be implemented by the specific federation implementation to handle errors encountered during normal operations.- Parameters:
cause- The error that caused the operation to fail.
-
handleFederationInitialized
Provides an entry point for the concrete federation implementation to respond to being initialized.- Throws:
ActiveMQException- if an error is thrown during initialization handling.
-
handleFederationStarted
Provides an entry point for the concrete federation implementation to respond to being started.- Throws:
ActiveMQException- if an error is thrown during start handling.
-
handleFederationStopped
Provides an entry point for the concrete federation implementation to respond to being stopped.- Throws:
ActiveMQException- if an error is thrown during stop handling.
-
handleFederationShutdown
Provides an entry point for the concrete federation implementation to respond to being shutdown.- Throws:
ActiveMQException- if an error is thrown during initialization handling.
-
invokeLinkClosedInterceptors
protected final boolean invokeLinkClosedInterceptors(org.apache.qpid.proton.engine.Link link) -
signalFederationStarted
protected final void signalFederationStarted() -
signalFederationStopped
protected final void signalFederationStopped()
-