Interface MultiNodesEvents

  • All Known Implementing Classes:
    MultiNodesEventsDbImpl

    public interface MultiNodesEvents
    Allows to publish simple low-level events to other TeamCity nodes in multi-nodes setup. It's important that every event can have only one subscriber. If you need to react on event in several places then you should implement one 'main' listener which will handle the event and propagate it to all the interested parts. Also subscribers should assume that the event can be sometimes outdated, i.e. 'buildStarted' event may happen when the node is already aware of the build.
    • Method Detail

      • publish

        void publish​(@NotNull
                     String eventName)
      • publish

        void publish​(@NotNull
                     String eventName,
                     @NotNull
                     Long longArg)
      • publish

        void publish​(@NotNull
                     String eventName,
                     @NotNull
                     String strArg)
      • subscribeOnEvents

        void subscribeOnEvents​(@NotNull
                               String eventName,
                               @NotNull
                               Consumer<List<MultiNodesEvents.Event>> eventConsumer)
                        throws IllegalArgumentException
        Adds an "events consumer" which will process a pack of consequitive events with the same name at once. There can be only one consumer per each event name.
        Parameters:
        eventName -
        eventConsumer -
        Throws:
        IllegalArgumentException - if another consumer for this event name is already registered
        Since:
        2021.2
      • unsubscribe

        void unsubscribe​(@NotNull
                         String eventName)
        unregister consumer for specified event name
        Since:
        2020.2.4
      • ensureEventsProcessed

        void ensureEventsProcessed()
        Loads and processes all fresh events
      • hasUnpublishedEvent

        boolean hasUnpublishedEvent​(@NotNull
                                    MultiNodesEvents.EventData eventData)
        Parameters:
        eventData -
        Returns:
        true if event is still not published and other nodes can't see it
      • hasUnpublishedEvents

        boolean hasUnpublishedEvents​(@NotNull
                                     Filter<MultiNodesEvents.EventData> eventsFilter)
        Returns:
        true if at least one event that match specified filter is still not published and other nodes can't see it
      • ensureEventsProcessed

        void ensureEventsProcessed​(@NotNull
                                   Filter<MultiNodesEvents.EventData> eventsFilter)
        Ensure that all events which have been published by other nodes and match the filter are processed.
      • eventsPublishingEnabled

        boolean eventsPublishingEnabled()