public Source <EventEnvelope, NotUsed> CurrentEventsByPersistenceId(
     string persistenceId,
     long fromSequenceNr,
     long toSequenceNr)
 {
     return(Source.ActorPublisher <EventEnvelope>(EventsByPersistenceIdPublisher.Props(
                                                      persistenceId,
                                                      fromSequenceNr,
                                                      toSequenceNr,
                                                      null,
                                                      _maxBufferSize,
                                                      _writeJournalPluginId))
            .MapMaterializedValue(_ => NotUsed.Instance)
            .Named("CurrentEventsByPersistenceId-" + persistenceId));
 }
Пример #2
0
 /// <summary>
 /// <see cref="EventsByPersistenceId"/> is used for retrieving events for a specific
 /// <see cref="PersistentActor"/> identified by <see cref="Eventsourced.PersistenceId"/>.
 /// <para>
 /// You can retrieve a subset of all events by specifying <paramref name="fromSequenceNr"/> and <paramref name="toSequenceNr"/>
 /// or use `0L` and <see cref="long.MaxValue"/> respectively to retrieve all events. Note that
 /// the corresponding sequence number of each event is provided in the
 /// <see cref="EventEnvelope"/>, which makes it possible to resume the
 /// stream at a later point from a given sequence number.
 /// </para>
 /// The returned event stream is ordered by sequence number, i.e. the same order as the
 /// <see cref="PersistentActor"/> persisted the events. The same prefix of stream elements (in same order)
 ///  are returned for multiple executions of the query, except for when events have been deleted.
 /// <para>
 /// The stream is not completed when it reaches the end of the currently stored events,
 /// but it continues to push new events when new events are persisted.
 /// Corresponding query that is completed when it reaches the end of the currently
 /// stored events is provided by <see cref="CurrentEventsByPersistenceId"/>.
 /// </para>
 /// The SQLite write journal is notifying the query side as soon as events are persisted, but for
 /// efficiency reasons the query side retrieves the events in batches that sometimes can
 /// be delayed up to the configured `refresh-interval`.
 /// <para></para>
 /// The stream is completed with failure if there is a failure in executing the query in the
 /// backend journal.
 /// </summary>
 public Source <EventEnvelope, NotUsed> EventsByPersistenceId(string persistenceId, long fromSequenceNr, long toSequenceNr) =>
 Source.ActorPublisher <EventEnvelope>(EventsByPersistenceIdPublisher.Props(persistenceId, fromSequenceNr, toSequenceNr, _refreshInterval, _maxBufferSize, _writeJournalPluginId))
 .MapMaterializedValue(_ => NotUsed.Instance)
 .Named("EventsByPersistenceId-" + persistenceId) as Source <EventEnvelope, NotUsed>;