Class AMQPFederationPolicySupport
- java.lang.Object
-
- org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederationPolicySupport
-
public final class AMQPFederationPolicySupport extends Object
Tools used when loading AMQP Broker connections configuration that includes Federation configuration.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_QUEUE_RECEIVER_PRIORITY_ADJUSTMENTDefault priority adjustment used for a federation queue match policy if nothing was configured in the broker configuration file.static org.apache.qpid.proton.amqp.SymbolFEDERATED_ADDRESS_SOURCE_PROPERTIESProperty name used to embed a nested map of properties meant to be applied if the address indicated in an federation address receiver auto creates the federated address.static org.apache.qpid.proton.amqp.SymbolMESSAGE_HOPS_ANNOTATIONAnnotation added to received messages from address consumers that indicates how many times the message has traversed a federation link.static StringMESSAGE_HOPS_PROPERTYProperty value placed on Core messages to indicate number of hops that a message has made when crossing Federation links.
-
Constructor Summary
Constructors Constructor Description AMQPFederationPolicySupport()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FederationReceiveFromAddressPolicycreate(AMQPFederationAddressPolicyElement element, WildcardConfiguration wildcards)From the broker AMQP broker connection configuration element and the configured wild-card settings create an address match policy.static FederationReceiveFromQueuePolicycreate(AMQPFederationQueuePolicyElement element, WildcardConfiguration wildcards)From the broker AMQP broker connection configuration element and the configured wild-card settings create an queue match policy.static FederationReceiveFromAddressPolicydecodeReceiveFromAddressPolicy(AMQPMessage message, WildcardConfiguration wildcardConfig)Given an AMQP Message decode anFederationReceiveFromAddressPolicyfrom it and return the decoded value.static FederationReceiveFromQueuePolicydecodeReceiveFromQueuePolicy(AMQPMessage message, WildcardConfiguration wildcardConfig)Given an AMQP Message decode anFederationReceiveFromQueuePolicyfrom it and return the decoded value.static AMQPMessageencodeAddressPolicyControlMessage(FederationReceiveFromAddressPolicy policy)Create an AMQP Message used to instruct the remote peer that it should perform Federation operations on the givenFederationReceiveFromAddressPolicy.static AMQPMessageencodeQueuePolicyControlMessage(FederationReceiveFromQueuePolicy policy)Create an AMQP Message used to instruct the remote peer that it should perform Federation operations on the givenFederationReceiveFromQueuePolicy.static StringgenerateAddressFilter(int maxHops)Constructs an address filter for a federated address receiver link that deals with both AMQP messages and unwrapped Core messages which can carry different hops markers.
-
-
-
Field Detail
-
DEFAULT_QUEUE_RECEIVER_PRIORITY_ADJUSTMENT
public static final int DEFAULT_QUEUE_RECEIVER_PRIORITY_ADJUSTMENT
Default priority adjustment used for a federation queue match policy if nothing was configured in the broker configuration file.- See Also:
- Constant Field Values
-
MESSAGE_HOPS_ANNOTATION
public static final org.apache.qpid.proton.amqp.Symbol MESSAGE_HOPS_ANNOTATION
Annotation added to received messages from address consumers that indicates how many times the message has traversed a federation link.
-
MESSAGE_HOPS_PROPERTY
public static final String MESSAGE_HOPS_PROPERTY
Property value placed on Core messages to indicate number of hops that a message has made when crossing Federation links. This value is used when Core messages are tunneled via an AMQP custom message and then recreated again on the other side.- See Also:
- Constant Field Values
-
FEDERATED_ADDRESS_SOURCE_PROPERTIES
public static final org.apache.qpid.proton.amqp.Symbol FEDERATED_ADDRESS_SOURCE_PROPERTIES
Property name used to embed a nested map of properties meant to be applied if the address indicated in an federation address receiver auto creates the federated address.
-
-
Method Detail
-
generateAddressFilter
public static String generateAddressFilter(int maxHops)
Constructs an address filter for a federated address receiver link that deals with both AMQP messages and unwrapped Core messages which can carry different hops markers. If the max is less than or equal to zero no filter is created as these values are used to indicate no max hops for federated messages on an address.- Parameters:
maxHops- The max allowed number of hops before a message should stop crossing federation links.- Returns:
- the address filter string that should be applied (or null).
-
encodeQueuePolicyControlMessage
public static AMQPMessage encodeQueuePolicyControlMessage(FederationReceiveFromQueuePolicy policy)
Create an AMQP Message used to instruct the remote peer that it should perform Federation operations on the givenFederationReceiveFromQueuePolicy.- Parameters:
policy- The policy to encode into an AMQP message.- Returns:
- an AMQP Message with the encoded policy.
-
encodeAddressPolicyControlMessage
public static AMQPMessage encodeAddressPolicyControlMessage(FederationReceiveFromAddressPolicy policy)
Create an AMQP Message used to instruct the remote peer that it should perform Federation operations on the givenFederationReceiveFromAddressPolicy.- Parameters:
policy- The policy to encode into an AMQP message.- Returns:
- an AMQP Message with the encoded policy.
-
decodeReceiveFromQueuePolicy
public static FederationReceiveFromQueuePolicy decodeReceiveFromQueuePolicy(AMQPMessage message, WildcardConfiguration wildcardConfig) throws ActiveMQException
Given an AMQP Message decode anFederationReceiveFromQueuePolicyfrom it and return the decoded value. The message should have already been inspected and determined to be an control message of the add to policy type.- Parameters:
message- TheAMQPMessagethat should carry an encodedFederationReceiveFromQueuePolicywildcardConfig- TheWildcardConfigurationto use in the decoded policy.- Returns:
- a decoded
FederationReceiveFromQueuePolicyinstance. - Throws:
ActiveMQException- if an error occurs while decoding the policy.
-
decodeReceiveFromAddressPolicy
public static FederationReceiveFromAddressPolicy decodeReceiveFromAddressPolicy(AMQPMessage message, WildcardConfiguration wildcardConfig) throws ActiveMQException
Given an AMQP Message decode anFederationReceiveFromAddressPolicyfrom it and return the decoded value. The message should have already been inspected and determined to be an control message of the add to policy type.- Parameters:
message- TheAMQPMessagethat should carry an encodedFederationReceiveFromQueuePolicywildcardConfig- TheWildcardConfigurationto use in the decoded policy.- Returns:
- a decoded
FederationReceiveFromAddressPolicyinstance. - Throws:
ActiveMQException- if an error occurs during the policy decode.
-
create
public static FederationReceiveFromAddressPolicy create(AMQPFederationAddressPolicyElement element, WildcardConfiguration wildcards)
From the broker AMQP broker connection configuration element and the configured wild-card settings create an address match policy.- Parameters:
element- The broker connections element configuration that creates this policy.wildcards- The configured wild-card settings for the broker or defaults.- Returns:
- a new address match and handling policy for use in the broker connection.
-
create
public static FederationReceiveFromQueuePolicy create(AMQPFederationQueuePolicyElement element, WildcardConfiguration wildcards)
From the broker AMQP broker connection configuration element and the configured wild-card settings create an queue match policy. If not configured otherwise the consumer priority value is always defaulted to a value of-1in order to attempt to prevent federation consumers from consuming messages on the remote when a local consumer is present.- Parameters:
element- The broker connections element configuration that creates this policy.wildcards- The configured wild-card settings for the broker or defaults.- Returns:
- a new queue match and handling policy for use in the broker connection.
-
-