Interface EventService


  • public interface EventService
    The EventService interface.

    Is instantiated using the static create methods within the interface eg:

    final EventService eventService = EventService.usingPeer("...");
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <EventT extends Event<?>>
      java.lang.AutoCloseable
      consumeEvents​(EventType eventType, EventTarget eventTarget, java.lang.Long startFrom, java.util.function.Consumer<EventT> onSuccess, java.util.function.Consumer<java.lang.Throwable> onFailure)
      Reads a stream of events from a node *
      static EventService usingPeer​(java.net.URI uri)
      Creates a new EventService for the specified host including protocol and port
    • Method Detail

      • consumeEvents

        <EventT extends Event<?>> java.lang.AutoCloseable consumeEvents​(EventType eventType,
                                                                        EventTarget eventTarget,
                                                                        java.lang.Long startFrom,
                                                                        java.util.function.Consumer<EventT> onSuccess,
                                                                        java.util.function.Consumer<java.lang.Throwable> onFailure)
        Reads a stream of events from a node *
        Type Parameters:
        EventT - the type of the event
        Parameters:
        eventType - the type of event to read
        eventTarget - the target of the event JSON string or POJO
        startFrom - the optional event to start streaming from, if not present only obtains new events
        onSuccess - the consumer of the successful events
        onFailure - the consumer of failures
      • usingPeer

        static EventService usingPeer​(java.net.URI uri)
        Creates a new EventService for the specified host including protocol and port
        Parameters:
        uri - the uri of the host to connect to must include protocol, hostname, and port number
        Returns:
        the event service for the specified host