/// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="streamProvider">Stream provider to be used.</param>
 /// <param name="tearDownFunc">Function to be executed after tear down.</param>
 public TransactionalStreamConsumer(IStreamProvider streamProvider, Func <Task> tearDownFunc = null)
 {
     MessageDispatcher   = new StreamMessageDispatchReceiver(streamProvider, null, tearDownFunc);
     TransactionReceiver = new StreamTransactionReceiver(MessageDispatcher);
     // ReSharper disable once VirtualMemberCallInConstructor
     SetupMessageDispatcher(MessageDispatcher);
 }
Exemple #2
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="dispatchReceiver">Dispatcher used to subscribe to transaction message.</param>
 public StreamTransactionReceiver(StreamMessageDispatchReceiver dispatchReceiver)
 {
     _awaitedTransactions       = new Dictionary <Guid, TaskCompletionSource <Task> >();
     _awaitedTransactionCounter = new Dictionary <Guid, int>();
     dispatchReceiver.Register <TransactionMessage>(ProcessTransactionMessage);
 }
 protected virtual void SetupMessageDispatcher(StreamMessageDispatchReceiver dispatcher)
 {
 }
 protected override void SetupMessageDispatcher(StreamMessageDispatchReceiver dispatcher)
 {
     base.SetupMessageDispatcher(dispatcher);
     dispatcher.Register <ItemMessage <T> >(ProcessItemAddMessage);
 }