1

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.

gre_gor
  • 6,669
  • 9
  • 47
  • 52

1 Answers1

2

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);
    });
});
Chris Patterson
  • 28,659
  • 3
  • 47
  • 59
  • tnk chris, Is there a way to automatically register all activity? – Mohammad Bigdeli Feb 17 '21 at 10:46
  • 1
    Using the container registration, you can automatically register everything. See [this sample](https://github.com/MassTransit/Sample-ForkJoint/blob/master/src/ForkJoint.Api/Startup.cs#L92) as an example. – Chris Patterson Feb 17 '21 at 13:07
  • Chris there doesn't seem to be any documentation for ExecuteActivityHost/CompensateActivityHost on the main docs site. I can't find anything under https://masstransit-project.com/advanced/courier/activities.html at least. – Sam Mar 30 '22 at 02:56
  • Manual bus configuration is no longer documented, you should use the container-based methods. – Chris Patterson Mar 30 '22 at 03:45