private async Task OnSagaProcessingStart(ExecutionStartMessage msg) { ISagaLocking sagaLocking = serviceProvider.GetRequiredService <ISagaLocking>(); if (!await sagaLocking.Acquire(msg.SagaID)) { throw new SagaIsBusyException(msg.SagaID); } }
private async Task OnSagaProcessingStart(ExecutionStartMessage msg) { ISagaLocking sagaLocking = serviceProvider.GetRequiredService <ISagaLocking>(); var id = msg?.Saga?.Data?.ID; if (id == null) { return; } if (!await sagaLocking.Acquire(id.Value)) { throw new SagaIsBusyException(id.Value); } }