Exemple #1
0
        /// <summary>
        /// Same type of query as <see cref="EventsByTag"/> but the event stream
        /// is completed immediately when it reaches the end of the "result set". Events that are
        /// stored after the query is completed are not included in the event stream.
        /// </summary>
        public Source <EventEnvelope, NotUsed> CurrentEventsByTag(string tag, Offset offset = null)
        {
            offset = offset ?? new Sequence(0L);
            switch (offset)
            {
            case Sequence seq:
                return(Source.ActorPublisher <EventEnvelope>(EventsByTagPublisher.Props(tag, seq.Value, long.MaxValue, null, _maxBufferSize, _writeJournalPluginId))
                       .MapMaterializedValue(_ => NotUsed.Instance)
                       .Named($"CurrentEventsByTag-{tag}"));

            case NoOffset _:
                return(CurrentEventsByTag(tag, new Sequence(0L)));

            default:
                throw new ArgumentException($"SqlReadJournal does not support {offset.GetType().Name} offsets");
            }
        }
Exemple #2
0
 /// <summary>
 /// Same type of query as <see cref="EventsByTag"/> but the event stream
 /// is completed immediately when it reaches the end of the "result set". Events that are
 /// stored after the query is completed are not included in the event stream.
 /// </summary>
 public Source <EventEnvelope, NotUsed> CurrentEventsByTag(string tag, long offset) =>
 Source.ActorPublisher <EventEnvelope>(EventsByTagPublisher.Props(tag, offset, long.MaxValue, null, _maxBufferSize, _writeJournalPluginId))
 .MapMaterializedValue(_ => NotUsed.Instance)
 .Named("EventsByTag-" + tag);