Class AMQPFederation
- java.lang.Object
-
- org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederation
-
- All Implemented Interfaces:
Federation,FederationInternal
- Direct Known Subclasses:
AMQPFederationSource,AMQPFederationTarget
public abstract class AMQPFederation extends Object implements FederationInternal
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
Fields Modifier and Type Field Description protected Map<String,FederationAddressPolicyManager>addressMatchPoliciesprotected booleanconnectedprotected AMQPConnectionContextconnectionprotected AMQPFederationEventDispatchereventDispatcherprotected AMQPFederationEventProcessoreventProcessorstatic StringFEDERATION_INSTANCE_RECORDValue 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 Map<String,Predicate<org.apache.qpid.proton.engine.Link>>linkClosedinterceptorsprotected Stringnameprotected Map<String,FederationQueuePolicyManager>queueMatchPoliciesprotected ScheduledExecutorServiceschedulerprotected org.apache.activemq.artemis.core.server.ActiveMQServerserverprotected AMQPSessionContextsessionprotected booleanstartedprotected WildcardConfigurationwildcardConfiguration
-
Constructor Summary
Constructors Constructor Description AMQPFederation(String name, org.apache.activemq.artemis.core.server.ActiveMQServer server)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AMQPFederationaddAddressMatchPolicy(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.AMQPFederationaddLinkClosedInterceptor(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.AMQPFederationaddQueueMatchPolicy(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 AMQPConnectionContextgetConnectionContext()abstract intgetLargeMessageThreshold()abstract intgetLinkAttachTimeout()StringgetName()abstract intgetReceiverCredits()abstract intgetReceiverCreditsLow()ScheduledExecutorServicegetScheduler()org.apache.activemq.artemis.core.server.ActiveMQServergetServer()abstract AMQPSessionContextgetSessionContext()WildcardConfigurationgetWildcardConfiguration()protected voidhandleFederationStarted()Provides an entry point for the concrete federation implementation to respond to being started.protected voidhandleFederationStopped()Provides an entry point for the concrete federation implementation to respond to being stopped.protected booleaninvokeLinkClosedInterceptors(org.apache.qpid.proton.engine.Link link)abstract booleanisCoreMessageTunnelingEnabled()abstract booleanisIgnoreQueueConsumerFilters()abstract booleanisIgnoreQueueConsumerPriorities()booleanisStarted()AMQPFederationremoveLinkClosedInterceptor(String id)Remove a previously registered link close interceptor from the list of close interceptor bindings.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 voidsignalFederationStarted()protected voidsignalFederationStopped()protected abstract voidsignalResourceCreateError(Exception cause)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.voidstart()Start the federation instance if not already started.voidstop()Stop the federation instance if not already stopped.
-
-
-
Field Detail
-
FEDERATION_INSTANCE_RECORD
public static final String 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:
- Constant Field Values
-
queueMatchPolicies
protected final Map<String,FederationQueuePolicyManager> queueMatchPolicies
-
addressMatchPolicies
protected final Map<String,FederationAddressPolicyManager> addressMatchPolicies
-
linkClosedinterceptors
protected final Map<String,Predicate<org.apache.qpid.proton.engine.Link>> linkClosedinterceptors
-
wildcardConfiguration
protected final WildcardConfiguration wildcardConfiguration
-
scheduler
protected final ScheduledExecutorService scheduler
-
name
protected final String name
-
server
protected final org.apache.activemq.artemis.core.server.ActiveMQServer server
-
eventDispatcher
protected AMQPFederationEventDispatcher eventDispatcher
-
eventProcessor
protected AMQPFederationEventProcessor eventProcessor
-
connection
protected volatile AMQPConnectionContext connection
-
session
protected volatile AMQPSessionContext session
-
started
protected boolean started
-
connected
protected volatile boolean connected
-
-
Constructor Detail
-
AMQPFederation
public AMQPFederation(String name, org.apache.activemq.artemis.core.server.ActiveMQServer server)
-
-
Method Detail
-
getWildcardConfiguration
public WildcardConfiguration getWildcardConfiguration()
- Returns:
- the
WildcardConfigurationthat is in use by this server federation.
-
getScheduler
public ScheduledExecutorService getScheduler()
-
getServer
public org.apache.activemq.artemis.core.server.ActiveMQServer getServer()
- Specified by:
getServerin interfaceFederation- Returns:
- the
ActiveMQServerinstance assigned to thisFederation
-
getName
public String getName()
- Specified by:
getNamein interfaceFederation- Returns:
- the unique name that was assigned to this server federation connector.
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin interfaceFederation- Returns:
- is this federation instance started (may not be connected yet).
-
getConnectionContext
public abstract AMQPConnectionContext getConnectionContext()
- Returns:
- the session context assigned to this federation instance
-
getSessionContext
public abstract AMQPSessionContext getSessionContext()
- Returns:
- the session context assigned to this federation instance
-
getLinkAttachTimeout
public abstract int getLinkAttachTimeout()
- Returns:
- the timeout before signaling an error when creating remote link (0 mean disable).
-
getReceiverCredits
public abstract int getReceiverCredits()
- Returns:
- the configured
Receiverlink credit batch size.
-
getReceiverCreditsLow
public abstract int getReceiverCreditsLow()
- Returns:
- the configured
Receiverlink credit low value.
-
getLargeMessageThreshold
public abstract int getLargeMessageThreshold()
- Returns:
- the size in bytes before a message is considered large.
-
isIgnoreQueueConsumerFilters
public abstract boolean isIgnoreQueueConsumerFilters()
- Returns:
- the true if the federation should ignore filters on queue consumers.
-
isIgnoreQueueConsumerPriorities
public abstract boolean isIgnoreQueueConsumerPriorities()
- Returns:
- the true if the federation should ignore priorities on queue consumers.
-
isCoreMessageTunnelingEnabled
public abstract boolean isCoreMessageTunnelingEnabled()
- Returns:
- the true if the federation should support core message tunneling.
-
start
public final void start() throws ActiveMQExceptionDescription copied from interface:FederationInternalStart the federation instance if not already started.- Specified by:
startin interfaceFederationInternal- Throws:
ActiveMQException- if an error occurs during the start.
-
stop
public final void stop() throws ActiveMQExceptionDescription copied from interface:FederationInternalStop the federation instance if not already stopped.- Specified by:
stopin interfaceFederationInternal- Throws:
ActiveMQException- if an error occurs during the stop.
-
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
public AMQPFederation removeLinkClosedInterceptor(String id)
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
-
signalResourceCreateError
protected abstract void signalResourceCreateError(Exception cause)
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
protected abstract void signalError(Exception cause)
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.
-
handleFederationStarted
protected void handleFederationStarted() throws ActiveMQExceptionProvides an entry point for the concrete federation implementation to respond to being started.- Throws:
ActiveMQException- if an error is thrown during policy start.
-
handleFederationStopped
protected void handleFederationStopped() throws ActiveMQExceptionProvides an entry point for the concrete federation implementation to respond to being stopped.- Throws:
ActiveMQException- if an error is thrown during policy stop.
-
invokeLinkClosedInterceptors
protected boolean invokeLinkClosedInterceptors(org.apache.qpid.proton.engine.Link link)
-
signalFederationStarted
protected void signalFederationStarted()
-
signalFederationStopped
protected void signalFederationStopped()
-
-