Exemplo n.º 1
0
 /// <summary>
 /// Creates a sink that writes events to the event log identified by <paramref name="persitenceId"/>.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="persitenceId">persistence id of the event log</param>
 /// <returns></returns>
 public Sink <Emitted <T>, Task> Sink <T>(string persitenceId) =>
 AkkaPersistenceCodec <T> .Encoder(persitenceId).ToMaterialized(journal.EventSink(persitenceId), Keep.Right);
Exemplo n.º 2
0
 /// <summary>
 /// Creates a flow representing the event log identified by <paramref name="persistenceId"/>.
 /// Input events are written to the journal and emitted as output events
 /// after successful write. Before input events are requested from upstream
 /// the flow emits events that have been previously written to the journal
 /// (recovery phase).
 ///
 /// During recovery, events are emitted as <see cref="Delivered{T}"/> messages, recovery completion
 /// is signaled as <see cref="Recovered{T}"/> message, both subtypes of <see cref="Delivery{T}"/> After recovery,
 /// events are again emitted as <see cref="Delivered{T}"/> messages.
 ///
 /// It is the application's responsibility to ensure that there is only a
 /// single materialized instance with given `persistenceId` writing to the
 /// journal.
 /// </summary>
 /// <param name="persistenceId">persistence id of the event log</param>
 /// <typeparam name="T">A event type. Only events that are instances of given type are emitted by the flow.</typeparam>
 public Flow <Emitted <T>, Delivery <Durable <T> >, NotUsed> Flow <T>(string persistenceId) =>
 AkkaPersistenceCodec <T> .Create(persistenceId).Join(journal.EventLog(persistenceId));