Class EventRepository
java.lang.Object
com.opencqrs.framework.persistence.EventRepository
- All Implemented Interfaces:
EventReader,ImmediateEventPublisher
Default implementation of
EventReader and ImmediateEventPublisher.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.opencqrs.framework.persistence.EventReader
EventReader.ClientRequestor, EventReader.RawCallback, EventReader.UpcastedCallback -
Constructor Summary
ConstructorsConstructorDescriptionEventRepository(EsdbClient client, EventSource eventSource, EventTypeResolver eventTypeResolver, EventDataMarshaller eventDataMarshaller, EventUpcasters eventUpcasters) -
Method Summary
Modifier and TypeMethodDescriptionvoidconsumeRaw(EventReader.ClientRequestor clientRequestor, BiConsumer<EventReader.RawCallback, Event> eventConsumer) Consumes rawEvents from the givenEventReader.ClientRequestorand passes them to the given event consumer.publish(Consumer<EventPublisher> handler, List<Precondition> additionalPreconditions) Atomically publishes all events captured from the givenEventPublisherconsumer together with the additional preconditions.publish(List<CapturedEvent> events, List<Precondition> additionalPreconditions) Atomically publishes the given events together with the additional preconditions.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.opencqrs.framework.persistence.EventReader
consumeAsObject, consumeAsObject, consumeUpcasted, readAsObject, readRaw, readUpcastedMethods inherited from interface com.opencqrs.framework.persistence.ImmediateEventPublisher
publish, publish, publish
-
Constructor Details
-
EventRepository
public EventRepository(EsdbClient client, EventSource eventSource, EventTypeResolver eventTypeResolver, EventDataMarshaller eventDataMarshaller, EventUpcasters eventUpcasters)
-
-
Method Details
-
consumeRaw
public void consumeRaw(EventReader.ClientRequestor clientRequestor, BiConsumer<EventReader.RawCallback, Event> eventConsumer) Description copied from interface:EventReaderConsumes rawEvents from the givenEventReader.ClientRequestorand passes them to the given event consumer.- Specified by:
consumeRawin interfaceEventReader- Parameters:
clientRequestor- wrapping the client fetch operationeventConsumer- a bi-consumer called for each rawEventaccompanied by aEventReader.RawCallbackfor futher event processing, if needed
-
publish
public List<Event> publish(Consumer<EventPublisher> handler, List<Precondition> additionalPreconditions) Description copied from interface:ImmediateEventPublisherAtomically publishes all events captured from the givenEventPublisherconsumer together with the additional preconditions.- Specified by:
publishin interfaceImmediateEventPublisher- Parameters:
handler- callback capturing all events to be published atomicallyadditionalPreconditions- additional preconditions that must not be violated- Returns:
- the list of published
Events
-
publish
Description copied from interface:ImmediateEventPublisherAtomically publishes the given events together with the additional preconditions.- Specified by:
publishin interfaceImmediateEventPublisher- Parameters:
events- a list of captured events to be published atomicallyadditionalPreconditions- additional preconditions that must not be violated- Returns:
- the list of published
Events
-