public async Task HandleAsync(IMessageContext <InventoryCheckCompleted> context, CancellationToken cancellationToken = default) { _logger.LogInformation($"inventory check for order '{context.Message.OrderId}' completed!"); this.State.InventoryCheckCompleted = true; if (CheckCanShipOrder(cancellationToken)) { var message = ProcessShipping.New(this.State.OrderId); this.Publish(message); } }
private async Task CheckStateAsync(CancellationToken cancellationToken = default) { var checksFulfilled = this.State.CreditCheckCompleted && this.State.InventoryCheckCompleted; if (!checksFulfilled) { return; } var message = ProcessShipping.New(this.State.OrderId); await this.Bus.PublishAsync(message, cancellationToken); }