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 TypeMethodDescriptionvoid
consumeRaw
(EventReader.ClientRequestor clientRequestor, BiConsumer<EventReader.RawCallback, Event> eventConsumer) Consumes rawEvent
s from the givenEventReader.ClientRequestor
and passes them to the given event consumer.publish
(Consumer<EventPublisher> handler, List<Precondition> additionalPreconditions) Atomically publishes all events captured from the givenEventPublisher
consumer 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, wait
Methods inherited from interface com.opencqrs.framework.persistence.EventReader
consumeAsObject, consumeAsObject, consumeUpcasted, readAsObject, readRaw, readUpcasted
Methods 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:EventReader
Consumes rawEvent
s from the givenEventReader.ClientRequestor
and passes them to the given event consumer.- Specified by:
consumeRaw
in interfaceEventReader
- Parameters:
clientRequestor
- wrapping the client fetch operationeventConsumer
- a bi-consumer called for each rawEvent
accompanied by aEventReader.RawCallback
for futher event processing, if needed
-
publish
public List<Event> publish(Consumer<EventPublisher> handler, List<Precondition> additionalPreconditions) Description copied from interface:ImmediateEventPublisher
Atomically publishes all events captured from the givenEventPublisher
consumer together with the additional preconditions.- Specified by:
publish
in interfaceImmediateEventPublisher
- Parameters:
handler
- callback capturing all events to be published atomicallyadditionalPreconditions
- additional preconditions that must not be violated- Returns:
- the list of published
Event
s
-
publish
Description copied from interface:ImmediateEventPublisher
Atomically publishes the given events together with the additional preconditions.- Specified by:
publish
in interfaceImmediateEventPublisher
- Parameters:
events
- a list of captured events to be published atomicallyadditionalPreconditions
- additional preconditions that must not be violated- Returns:
- the list of published
Event
s
-