com.github.rahulsom.grooves.queries.TemporalQuery Maven / Gradle / Ivy
package com.github.rahulsom.grooves.queries;
import com.github.rahulsom.grooves.api.AggregateType;
import com.github.rahulsom.grooves.api.events.BaseEvent;
import com.github.rahulsom.grooves.api.snapshots.TemporalSnapshot;
import org.reactivestreams.Publisher;
import java.util.Date;
public interface TemporalQuery<
AggregateIdT,
AggregateT extends AggregateType,
EventIdT,
EventT extends BaseEvent,
SnapshotIdT,
SnapshotT extends TemporalSnapshot> {
/**
* Computes a snapshot for specified version of an aggregate.
*
* @param aggregate The aggregate
* @param moment The moment at which the snapshot is desired
*
* @return An Flowable that returns at most one Snapshot
*/
Publisher computeSnapshot(AggregateT aggregate, Date moment);
/**
* Computes a snapshot for specified version of an aggregate.
*
* @param aggregate The aggregate
* @param moment The moment at which the snapshot is desired
* @param redirect If there has been a deprecation, redirect to the current aggregate's
* snapshot. Defaults to true.
*
* @return An Optional SnapshotType. Empty if cannot be computed.
*/
Publisher computeSnapshot(AggregateT aggregate, Date moment, boolean redirect);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy