Class AMQPFederationPolicySupport
java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederationPolicySupport
Tools used when loading AMQP Broker connections configuration that includes Federation configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault priority adjustment used for a federation queue match policy if nothing was configured in the broker configuration file.static final org.apache.qpid.proton.amqp.SymbolProperty 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 final org.apache.qpid.proton.amqp.SymbolAnnotation added to received messages from address consumers that indicates how many times the message has traversed a federation link.static final StringProperty value placed on Core messages to indicate number of hops that a message has made when crossing Federation links. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(AMQPFederationAddressPolicyElement element, WildcardConfiguration wildcards) From the broker AMQP broker connection configuration element and the configured wild-card settings create an address match policy.create(AMQPFederationQueuePolicyElement element, WildcardConfiguration wildcards) From the broker AMQP broker connection configuration element and the configured wild-card settings create an queue match policy.decodeReceiveFromAddressPolicy(AMQPMessage message, WildcardConfiguration wildcardConfig) Given an AMQP Message decode anFederationReceiveFromAddressPolicyfrom it and return the decoded value.decodeReceiveFromQueuePolicy(AMQPMessage message, WildcardConfiguration wildcardConfig) Given an AMQP Message decode anFederationReceiveFromQueuePolicyfrom it and return the decoded value.static AMQPMessageCreate an AMQP Message used to instruct the remote peer that it should perform Federation operations on the givenFederationReceiveFromAddressPolicy.static AMQPMessageCreate 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 Details
-
DEFAULT_QUEUE_RECEIVER_PRIORITY_ADJUSTMENT
public static final int DEFAULT_QUEUE_RECEIVER_PRIORITY_ADJUSTMENTDefault priority adjustment used for a federation queue match policy if nothing was configured in the broker configuration file.- See Also:
-
MESSAGE_HOPS_ANNOTATION
public static final org.apache.qpid.proton.amqp.Symbol MESSAGE_HOPS_ANNOTATIONAnnotation added to received messages from address consumers that indicates how many times the message has traversed a federation link. -
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:
-
FEDERATED_ADDRESS_SOURCE_PROPERTIES
public static final org.apache.qpid.proton.amqp.Symbol FEDERATED_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.
-
-
Constructor Details
-
AMQPFederationPolicySupport
public AMQPFederationPolicySupport()
-
-
Method Details
-
generateAddressFilter
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
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
-