Interface EventReader
- All Known Implementing Classes:
EventRepository
public interface EventReader
Interface specifying operations for reading events from an
EsdbClient. This includes reading raw
Events, upcasted Events, or events converted to Java Objects and meta-data.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceGenerically wrapsEsdbClientcalls to consumeEvents.static interfaceCallback interface specifying operations to deal with an encapsulated rawEvent.static interfaceCallback interface specifying operations to deal with an encapsulated upcastedEvent. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidconsumeAsObject(EventReader.ClientRequestor clientRequestor, BiConsumer<Map<String, ?>, Object> eventConsumer) Consumes upcasted and converted meta-data and Java event objects from the givenEventReader.ClientRequestorand passes them to the given event consumer.default voidconsumeAsObject(EventReader.ClientRequestor clientRequestor, Consumer<Object> eventConsumer) Consumes upcasted and converted Java event objects from the givenEventReader.ClientRequestorand passes them to the given event consumer.voidconsumeRaw(EventReader.ClientRequestor clientRequestor, BiConsumer<EventReader.RawCallback, Event> eventConsumer) Consumes rawEvents from the givenEventReader.ClientRequestorand passes them to the given event consumer.default voidconsumeUpcasted(EventReader.ClientRequestor clientRequestor, BiConsumer<EventReader.UpcastedCallback, Event> eventConsumer) Consumes upcastedEvents from the givenEventReader.ClientRequestorand passes them to the given event consumer.readAsObject(String subject, Set<Option> options) Retrieves a list of upcasted and converted Java event objects matching the given subject and options.Retrieves a list of rawEvents matching the given subject and options.readUpcasted(String subject, Set<Option> options) Retrieves a list of upcastedEvents matching the given subject and options.
-
Method Details
-
consumeRaw
void consumeRaw(EventReader.ClientRequestor clientRequestor, BiConsumer<EventReader.RawCallback, Event> eventConsumer) Consumes rawEvents from the givenEventReader.ClientRequestorand passes them to the given event consumer.- Parameters:
clientRequestor- wrapping the client fetch operationeventConsumer- a bi-consumer called for each rawEventaccompanied by aEventReader.RawCallbackfor futher event processing, if needed
-
consumeUpcasted
default void consumeUpcasted(EventReader.ClientRequestor clientRequestor, BiConsumer<EventReader.UpcastedCallback, Event> eventConsumer) Consumes upcastedEvents from the givenEventReader.ClientRequestorand passes them to the given event consumer.- Parameters:
clientRequestor- wrapping the client fetch operationeventConsumer- a bi-consumer called for each upcastedEventaccompanied by anEventReader.UpcastedCallbackfor further event processing, if needed- See Also:
-
consumeAsObject
default void consumeAsObject(EventReader.ClientRequestor clientRequestor, Consumer<Object> eventConsumer) Consumes upcasted and converted Java event objects from the givenEventReader.ClientRequestorand passes them to the given event consumer.- Parameters:
clientRequestor- wrapping the client fetch operationeventConsumer- a consumer called for each upcasted and converted Java event object- See Also:
-
consumeAsObject
default void consumeAsObject(EventReader.ClientRequestor clientRequestor, BiConsumer<Map<String, ?>, Object> eventConsumer) Consumes upcasted and converted meta-data and Java event objects from the givenEventReader.ClientRequestorand passes them to the given event consumer.- Parameters:
clientRequestor- wrapping the client fetch operationeventConsumer- a bi-consumer called for each upcasted and converted meta-data and Java event object- See Also:
-
readRaw
Retrieves a list of rawEvents matching the given subject and options.- Parameters:
subject- the subject to fetch fromoptions- set of fetch options- Returns:
- a list of raw
Events, may be empty
-
readUpcasted
Retrieves a list of upcastedEvents matching the given subject and options.- Parameters:
subject- the subject to fetch fromoptions- set of fetch options- Returns:
- a list of upcasted
Events, may be empty
-
readAsObject
Retrieves a list of upcasted and converted Java event objects matching the given subject and options.- Parameters:
subject- the subject to fetch fromoptions- set of fetch options- Returns:
- a list of Java event objects, may be empty
-