admin管理员组

文章数量:1123598

I have the following use case:

I have a message called CreditCardStatusChanged, which looks like this:

public class CreditCardStatusChanged
{
    public required int CardId { get; init; }
    
    public required CreditCardStatus NewStatus { get; init; }
}

public enum CreditCardStatus
{
    Requested,
    Issued,
    Active,
    Blocked,
    Lost,
    Stolen,
    Destroyed,
    Expired,
    //etc...
}

I also have a consumer CreditCardStatusChangedConsumer:

public class CreditCardStatusChangedConsumer : IConsumer<CreditCardStatusChanged>
{
    public Task Consume(ConsumeContext<CreditCardStatusChanged> context)
    {
        //logic for changing credit card status
    }
}

Would it be possible to ensure that messages for the same card ID are executed in the exact order they were published, but still have parallel consumption for different card IDs?

FYI: I am using RabbitMQ transport.

Thanks!

本文标签: cIs it possible to process MassTransit messages for specific parameter sequentiallyStack Overflow