Re: [masstransit-discuss] [MT 3.3.5] Is calling Start/Stop really required when only sending?

28 views
Skip to first unread message

Chris Patterson

unread,
Jul 27, 2016, 12:54:15 AM7/27/16
to masstrans...@googlegroups.com
Yeah, Start should be called. It makes the connections and such happen and play nicely.

On Tue, Jul 26, 2016 at 5:03 PM, Jonathan Wong <jonh...@gmail.com> wrote:
Here is my block of code

public static void Main()
{
    IBusControl b = Bus.Factory.CreateUsingRabbitMq(c =>
    {
        c.Host(new Uri("rabbitmq://localhost/"),
            x =>
            {
                x.Username("admin");
                x.Password("admin");
            });
                
    });

    //b.Start();

    var s = b.GetSendEndpoint(new Uri("rabbitmq://localhost/someQueue?bind=true&queue=someQueue")).Result;            
    s.Send(new DownloadOrderRequest()).Wait();

    //b.Stop();
}

With Start and Stop commented out, the message is successfully queued without calling start on the bus control but prevents the process from exiting. Calling Stop without Start doesn't help the process exit. The process does, however, exit when both Start and Stop are called.

Does Send actually depend on starting the bus control? Should I be calling Start and Stop regardless for every use case?


Jon

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/91d3e72f-bcf6-4c0b-86b4-58f153dfe2a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages