Interface IEventService

    • Method Detail

      • publish

        void publish​(Event event)
        Publishes events. Published events will get dispatched to all subscribers in the order in which they subscribed. Subscribers are informed asynchronously one after the next.
        Parameters:
        event - An Event to publish
        Since:
        1.2.0
      • subscribe

        void subscribe​(Class<? extends Event> eventType,
                       Class<? extends Subscriber> subscriberType)
        Subscribes to an event. Subscribes are automatically notified of all events for which they are subscribed.
        Parameters:
        eventType - The type of event to subscribe to
        subscriberType - The Subscriber that gets informed when the type of event is published
        Since:
        1.2.0
      • unsubscribe

        void unsubscribe​(Class<? extends Subscriber> subscriberType)
        Unsubscribes a subscriber. All event types the subscriber has subscribed to will be unsubscribed. Once unsubscribed, the subscriber will no longer be informed of published events.
        Parameters:
        subscriberType - The Subscriber to unsubscribe.
        Since:
        1.2.0
      • hasSubscriptions

        boolean hasSubscriptions​(Event event)
        Determines if the specified event is able to be processed by the EventService. If a subscriber exists for the event type, this method will return true, otherwise false.
        Parameters:
        event - the event to query if subscribers exist
        Returns:
        true if the event has subscribers, false it not
        Since:
        1.2.0
      • shutdown

        void shutdown()
        Shuts down the executioner. Once shut down, future work will not be performed. This should only be called prior to the application being shut down.
        Since:
        1.2.0
      • isEventBeingProcessed

        boolean isEventBeingProcessed​(ChainableEvent event)
        Determines if the specified event is currently being processed. Processing may indicate the the subscriber task is in the queue and work has not started yet, or may indicate the task is currently being executed. When this event returns false, it does not indicate completion, only that there are no subscriber tasks waiting or working on the specified event.
        Parameters:
        event - the event to query
        Returns:
        a boolean
        Since:
        1.4.0
      • isEventBeingProcessed

        boolean isEventBeingProcessed​(UUID chainIdentifier)
        Determines if the specified event is currently being processed. Processing may indicate the the subscriber task is in the queue and work has not started yet, or may indicate the task is currently being executed. When this event returns false, it does not indicate completion, only that there are no subscriber tasks waiting or working on the specified event.
        Parameters:
        chainIdentifier - the UUID of the event to query
        Returns:
        a boolean
        Since:
        1.4.0