
com.github.rahulsom.grooves.queries.TemporalQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grooves-api Show documentation
Show all versions of grooves-api Show documentation
APIs that help in computation of Grooves based Snapshots
The newest version!
package com.github.rahulsom.grooves.queries;
import com.github.rahulsom.grooves.api.events.BaseEvent;
import com.github.rahulsom.grooves.api.snapshots.TemporalSnapshot;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Publisher;
import java.util.Date;
/**
* A query that produces a {@link TemporalSnapshot}.
*
* @param The aggregate over which the query executes
* @param The type of the EventT's id field
* @param The type of the event
* @param The type of the SnapshotT's id field
* @param The type of the snapshot
* @author Rahul Somasunderam
*/
public interface TemporalQuery<
AggregateT,
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 A Publisher that returns at most one Snapshot
*/
@NotNull Publisher computeSnapshot(
@NotNull AggregateT aggregate, @NotNull 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 it cannot be computed.
*/
@NotNull Publisher computeSnapshot(
@NotNull AggregateT aggregate, @NotNull Date moment, boolean redirect);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy