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 Details

    • 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:
    • 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:
    • 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.
  • Constructor Details

    • AMQPFederationPolicySupport

      public AMQPFederationPolicySupport()
  • Method Details

    • 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 given FederationReceiveFromQueuePolicy.
      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 given FederationReceiveFromAddressPolicy.
      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 an FederationReceiveFromQueuePolicy from 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 - The AMQPMessage that should carry an encoded FederationReceiveFromQueuePolicy
      wildcardConfig - The WildcardConfiguration to use in the decoded policy.
      Returns:
      a decoded FederationReceiveFromQueuePolicy instance
      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 an FederationReceiveFromAddressPolicy from 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 - The AMQPMessage that should carry an encoded FederationReceiveFromQueuePolicy
      wildcardConfig - The WildcardConfiguration to use in the decoded policy.
      Returns:
      a decoded FederationReceiveFromAddressPolicy instance
      Throws:
      ActiveMQException - if an error occurs during the policy decode.
    • create

      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

      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 -1 in 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