masstransitmasstransit-courier

How can I configure Mass Transit Courier using Bus.Factory.CreateUsingRabbitMq?


I am using Mass Transit Version 7 and I am facing a problem and I should note that I am a beginner in Mass Transit, so excuse me for my simple question.

My Question is How to Configure Mass Transit Courier using Bus.Factory.CreateUsingRabbitMq.


Solution

  • To configure activities without using a container, use the specific methods for compensate and execute activity hosts. There are different overloads if you need to specify an activity factory method or other configure the endpoint.

    Bus.Factory.CreateUsingRabbitMq(cfg =>
    {
        cfg.Host(...);
    
        Uri compensateAddress = default;
    
        cfg.ReceiveEndpoint("activity-compensate", x =>
        {
            x.CompensateActivityHost<TActivity, TLog>();
    
            compensateAddress = x.InputAddress;
        });
    
        cfg.ReceiveEndpoint("activity-execute", x =>
        {
            x.ExecuteActivityHost<TActivity, TArguments>(compensateAddress);
        });
    });