/// <summary> /// Publish any pending saga timeouts. /// </summary> /// <param name="sagaTimeouts">The set of saga timeouts to dispatch.</param> private void DispatchSagaTimeouts(IEnumerable<SagaTimeout> sagaTimeouts) { Log.Trace("Dispatching saga timeouts"); var eventPublisher = lazyEventPublisher.Value; foreach (var sagaTimeout in sagaTimeouts) { var eventVersion = new EventVersion(Int32.MaxValue, 1, 1); var e = new Timeout(sagaTimeout.SagaType, sagaTimeout.Timeout); eventPublisher.Publish(HeaderCollection.Empty, new EventEnvelope(GuidStrategy.NewGuid(), sagaTimeout.SagaId, eventVersion, e)); } Log.Trace("Saga timeouts dispatched"); }
public void Handle(Timeout e) { if (MoneySent && !MoneyReceived && !MoneyRefunded) { MoneyRefunded = true; Publish(FromAccountId, new RefundMoneyTransfer(CorrelationId, Amount)); } }