Package com.casper.sdk.service
Interface EventService
-
public interface EventServiceThe 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.AutoCloseableconsumeEvents(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 EventServiceusingPeer(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 readeventTarget- the target of the event JSON string or POJOstartFrom- the optional event to start streaming from, if not present only obtains new eventsonSuccess- the consumer of the successful eventsonFailure- 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
-
-