Class FederationQueuePolicyManager

    • Method Detail

      • start

        public void start()
        Start the queue policy manager which will initiate a scan of all broker queue bindings and create and matching remote receivers. Start on a policy manager should only be called after its parent Federation is started and the federation connection has been established.
      • stop

        public void stop()
        Stops the queue policy manager which will close any open remote receivers that are active for local queue demand. Stop should generally be called whenever the parent Federation loses its connection to the remote.
      • scanAllQueueBindings

        protected final void scanAllQueueBindings()
      • checkQueueForMatch

        protected final void checkQueueForMatch​(org.apache.activemq.artemis.core.server.Queue queue)
      • reactIfConsumerMatchesPolicy

        protected final void reactIfConsumerMatchesPolicy​(org.apache.activemq.artemis.core.server.ServerConsumer consumer)
      • testIfQueueMatchesPolicy

        protected boolean testIfQueueMatchesPolicy​(String address,
                                                   String queueName)
        Performs the test against the configured queue policy to check if the target queue and its associated address is a match or not. A subclass can override this method and provide its own match tests in combination with the configured matching policy.
        Parameters:
        address - The address that is being tested for a policy match.
        queueName - The name of the queue that is being tested for a policy match.
        Returns:
        true if the address given is a match against the policy.
      • createConsumerInfo

        protected FederationConsumerInfo createConsumerInfo​(org.apache.activemq.artemis.core.server.ServerConsumer consumer)
        Create a new FederationConsumerInfo based on the given ServerConsumer and the configured FederationReceiveFromQueuePolicy. A subclass can override this method to return a consumer information object with additional data used be that implementation.
        Parameters:
        consumer - The ServerConsumer to use as a basis for the consumer information object.
        Returns:
        a new FederationConsumerInfo instance based on the server consumer
      • createFederationConsumerMatcher

        protected Predicate<org.apache.activemq.artemis.core.server.ServerConsumer> createFederationConsumerMatcher​(org.apache.activemq.artemis.core.server.ActiveMQServer server,
                                                                                                                    FederationReceiveFromQueuePolicy policy)
                                                                                                             throws ActiveMQException
        Creates a Predicate that should return true if the given consumer is a federation created consumer which should not be further federated.
        Parameters:
        server - The server instance for use in creating the filtering Predicate.
        policy - The configured Queue matching policy that can provide additional match criteria.
        Returns:
        a Predicate that will return true if the consumer should be filtered.
        Throws:
        ActiveMQException - if an error occurs while creating the new consumer filter.
      • signalBeforeCreateFederationConsumer

        protected abstract void signalBeforeCreateFederationConsumer​(FederationConsumerInfo info)
        Signal any registered plugins for this federation instance that a remote Queue consumer is being created.
        Parameters:
        info - The FederationConsumerInfo that describes the remote Queue consumer
      • signalAfterCreateFederationConsumer

        protected abstract void signalAfterCreateFederationConsumer​(FederationConsumer consumer)
        Signal any registered plugins for this federation instance that a remote Queue consumer has been created.
        Parameters:
        consumer - The FederationConsumerInfo that describes the remote Queue consumer
      • signalBeforeCloseFederationConsumer

        protected abstract void signalBeforeCloseFederationConsumer​(FederationConsumer consumer)
        Signal any registered plugins for this federation instance that a remote Queue consumer is about to be closed.
        Parameters:
        consumer - The FederationConsumer that that is about to be closed.
      • signalAfterCloseFederationConsumer

        protected abstract void signalAfterCloseFederationConsumer​(FederationConsumer consumer)
        Signal any registered plugins for this federation instance that a remote Queue consumer has now been closed.
        Parameters:
        consumer - The FederationConsumer that that has been closed.
      • isPluginBlockingFederationConsumerCreate

        protected abstract boolean isPluginBlockingFederationConsumerCreate​(org.apache.activemq.artemis.core.server.Queue queue)
        Query all registered plugins for this federation instance to determine if any wish to prevent a federation consumer from being created for the given Queue.
        Parameters:
        queue - The Queue that the federation queue manager is attempting to create a remote consumer for.
        Returns:
        true if any registered plugin signaled that creation should be suppressed.