question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I just follow the example :

builder.AddMassTransit(x =>
             {
                 //x.AddConsumers(Assembly.GetExecutingAssembly());
                 x.AddConsumer<DoSomethingConsumer>();
                 x.AddBus(context => Bus.Factory.CreateUsingRabbitMq(cfg =>
                 {
                     var host = cfg.Host(new Uri("rabbitmq://localhost/SkyWatch"), h =>
                     {
                         h.Username("SkyWatch");
                         h.Password("sky_watch_2019_best");

                     });

                     cfg.ReceiveEndpoint("web-service-endpoint", ec =>
                     {

                         //ec.ConfigureConsumers(context);
                         ec.Consumer<DoSomethingConsumer>();
                     });

                     // or, configure the endpoints by convention
                     cfg.ConfigureEndpoints(context);

                 }));
                 
                 //x.AddRequestClient<DoSomething>(new Uri("rabbitmq://localhost/SkyWatch/web-service-endpoint"));
             });

call consumer twice but when I remove " x.AddConsumer<DoSomethingConsumer>();" it works fine. how

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
phatboygcommented, Jul 25, 2019

Yeah, you’re using every example instead of just one approach.

Use either:

builder.AddMassTransit(x =>
{
    x.AddConsumers(Assembly.GetExecutingAssembly());

    x.AddBus(context => Bus.Factory.CreateUsingRabbitMq(cfg =>
    {
        var host = cfg.Host(new Uri("rabbitmq://localhost/Test1"), h =>
        {
            h.Username("SkyWatch");
            h.Password("sky_watch_2019_best");
        });

        cfg.ConfigureEndpoints(context);
    }));
});

or

builder.AddMassTransit(x =>
{
    x.AddConsumers(Assembly.GetExecutingAssembly());

    x.AddBus(context => Bus.Factory.CreateUsingRabbitMq(cfg =>
    {
        var host = cfg.Host(new Uri("rabbitmq://localhost/Test1"), h =>
        {
            h.Username("SkyWatch");
            h.Password("sky_watch_2019_best");
        });
        
        cfg.ReceiveEndpoint("web-service-endpoint", ec =>
        {
            ec.ConfigureConsumers(context);
        });    
    }));
}); 
2reactions
phatboygcommented, Jul 3, 2020

You can create a consumer definition, or you can configure the endpoint when registering the consumer.

https://masstransit-project.com/usage/containers/definitions.html

Or Use

x.AddConsumer<T>()
    .Endpoint(e => ...);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Twice: Consumer Electronic News | Blogs | Retailing ...
STORIS Launches New Integrated Credit Card Processing Solution. New solution allows retailers to connect to credit card gateway providers to automatically and..
Read more >
About Us
TWICE is the leading brand serving the B2B needs of those in the technology and consumer electronics industries. Anchored to a 12+ times...
Read more >
Twice (magazine)
Established in 1987, TWICE magazine is published twice monthly with an extra issue in January and September. Common topics covered include consumer ......
Read more >
Handling Duplicate Messages (Idempotent Consumers)
“At Least Once” message guarantees that a message will be delivered to a consumer once or many times. This means that you need...
Read more >
twice magazine Archives
TWICE is a trade publication and web site owned by NewBay Media serving the information needs of retailers, distributors and manufacturing representatives ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found