Class DiagnosticEventService

    • Method Detail

      • publish

        public void publish​(DiagnosticEvent event)
        Makes provided event available to all subscribers.
      • subscribe

        public <E extends DiagnosticEvent> void subscribe​(java.lang.Class<E> event,
                                                          java.util.function.Consumer<E> consumer)
        Registers event handler for specified class of events.
        Parameters:
        event - DiagnosticEvent class implementation
        consumer - Consumer for received events
      • subscribe

        public <E extends DiagnosticEvent,​T extends java.lang.Enum<T>> void subscribe​(java.lang.Class<E> event,
                                                                                            T eventType,
                                                                                            java.util.function.Consumer<E> consumer)
        Registers event handler for specified class of events.
        Parameters:
        event - DiagnosticEvent class implementation
        consumer - Consumer for received events
      • subscribeAll

        public void subscribeAll​(java.util.function.Consumer<DiagnosticEvent> consumer)
        Registers event handler for all DiagnosticEvents published from this point.
        Parameters:
        consumer - Consumer for received events
      • unsubscribe

        public <E extends DiagnosticEvent> void unsubscribe​(java.util.function.Consumer<E> consumer)
        De-registers event handler from receiving any further events.
        Parameters:
        consumer - Consumer registered for receiving events
      • unsubscribe

        public <E extends DiagnosticEvent> void unsubscribe​(@Nullable
                                                            java.lang.Class<E> event,
                                                            java.util.function.Consumer<E> consumer)
        De-registers event handler from receiving any further events.
        Parameters:
        event - DiagnosticEvent class to unsubscribe from
        consumer - Consumer registered for receiving events
      • hasSubscribers

        public <E extends DiagnosticEvent> boolean hasSubscribers​(java.lang.Class<E> event)
        Indicates if any Consumer has been registered for the specified class of events.
        Parameters:
        event - DiagnosticEvent class implementation
      • hasSubscribers

        public <E extends DiagnosticEvent,​T extends java.lang.Enum<T>> boolean hasSubscribers​(java.lang.Class<E> event,
                                                                                                    T eventType)
        Indicates if any Consumer has been registered for the specified class of events.
        Parameters:
        event - DiagnosticEvent class implementation
        eventType - Subscribed event type matched against DiagnosticEvent.getType()
      • cleanup

        public void cleanup()
        Removes all active subscribers. Should only be called from testing.
      • readEvents

        public java.util.SortedMap<java.lang.Long,​java.util.Map<java.lang.String,​java.io.Serializable>> readEvents​(java.lang.String eventClazz,
                                                                                                                               java.lang.Long lastKey,
                                                                                                                               int limit)
        Description copied from interface: DiagnosticEventServiceMBean
        Retrieved all events of specified type starting with provided key. Result will be sorted chronologically.
        Specified by:
        readEvents in interface DiagnosticEventServiceMBean
        Parameters:
        eventClazz - fqn of event class
        lastKey - ID of first event to retrieve
        limit - number of results to return