public bool CanRemoveInstance(TSaga instance) { bool canRemoveInstance = _policy.CanRemoveInstance(instance); if (canRemoveInstance) { _removed.Add(instance); } return(canRemoveInstance); }
public TSaga CreateInstance(IConsumeContext <TMessage> context, Guid sagaId) { TSaga instance = _policy.CreateInstance(context, sagaId); if (instance != null) { _created.Add(instance); } return(instance); }
IEnumerable <Action <IConsumeContext <TMessage> > > DecorateSelector <TMessage>(TSaga instance, IEnumerable <Action <IConsumeContext <TMessage> > > selector) where TMessage : class { foreach (var result in selector) { yield return(result); _sagas.Add(instance); } }
public async Task Send(SagaConsumeContext <TSaga, TMessage> context) { _sagas.Add(context); try { await _pipe.Send(context).ConfigureAwait(false); _received.Add(context); } catch (Exception ex) { _received.Add(context, ex); throw; } }
public Task Send(SagaConsumeContext <TSaga, TMessage> context) { _created.Add(context); return(_pipe.Send(context)); }