Skip to content

can you ensure Basket checkout atomicity #56

Closed
@liuzhixin405

Description

@liuzhixin405

in basket api basketcontroller Checkout:


var basket = await _repository.GetBasket(basketCheckout.UserName);
if (basket == null)
{
return BadRequest();
}

        // send checkout event to rabbitmq
        var eventMessage = _mapper.Map<BasketCheckoutEvent>(basketCheckout);
        eventMessage.TotalPrice = basket.TotalPrice;
        await _publishEndpoint.Publish<BasketCheckoutEvent>(eventMessage);

        // remove the basket
        await _repository.DeleteBasket(basket.UserName);

        return Accepted();

if MassTransit publish or IBasketRepository delete fail,the checkout business is fail . can you use the transcation to achieve
checkout 's atomicity ,fianlly this is comply eventual consistency,
thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions