Class SubscriptionMatcher


  • public class SubscriptionMatcher
    extends java.lang.Object
    Matcher is responsible for holding all subscriptions and match them to incoming events. Matching process is based on subscription id which is represented by 4 subscription types: <receiver>.<component>.<operation_id>.<unique_id> <receiver> - Uniquely identifies host from which event arrived <component> - Logical component like: Storage, Virt etc <operation_id> - Operation identifier like Image.create <unique_id> - Identifier of a specific operation User can subscribe to all events by defining '*' for each subscription type. Registration for all possible events like '*|*|*|*' is not allowed. User can register for specific component operation using '*|storage|*|*' which means that all events triggered by storage component are delivered to a subscriber.
    • Constructor Detail

      • SubscriptionMatcher

        public SubscriptionMatcher()
    • Method Detail

      • add

        public void add​(SubscriptionHolder holder)
        Adds a SubscriptionHolder which will be used for event matching
        Parameters:
        holder - Instance holding subscription information.
      • match

        public java.util.Set<SubscriptionHolder> match​(JsonRpcEvent event)
        Matches current subscriptions to an event and returns a Set containing all subscriptions that match for this event processing.
        Parameters:
        event - Incoming event used to match subscribers.
        Returns:
        A Set with matched subscriptions.
      • remove

        public void remove​(SubscriptionHolder holder)
        Used during removal of a subscription.
        Parameters:
        holder - Object holding information about subscription being removed.