Problem sending a message

400 views
Skip to first unread message

kouko...@gmail.com

unread,
Mar 26, 2014, 1:14:48 PM3/26/14
to masstrans...@googlegroups.com

I am using MassTransit and RaabbitMQ and when I try to send a message I get this error:

rabbitmq://localhost/FilesVersioning => An exception was thrown during Send 
 
at MassTransit.Transports.Endpoint.Send[T](ISendContext`1 context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Endpoint.cs:line 116 
at MassTransit.Transports.Endpoint.Send[T](T message) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Endpoint.cs:line 125 
at ServicesImplementation.DVService.<>c__DisplayClass7.b__6() in D:\MyProject\trunk\ServicesImplementation\DocVersioningService.cs:line 111 
at FileSystemIO.FileSystemTransaction.ExecutePreCommitActions() in D:\MyProject\trunk\FileSystemIO\FileSystemTransaction.cs:line 106 
at Domain.Repositories.NHibernateSessionModule.EndSession(ISession session) in D:\MyProject\trunk\Domain\Repositories\NHibernateSessionModule.cs:line 205 
at Domain.Repositories.NHibernateSessionModule.ContextEndRequest(Object sender, EventArgs e) in D:\MyProject\trunk\Domain\Repositories\NHibernateSessionModule.cs:line 137 
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 
 
___________________________________ 
rabbitmq://localhost/FilesVersioning => Publisher did not confirm message 
 
at MassTransit.Transports.RabbitMq.OutboundRabbitMqTransport.<>c__DisplayClass3.b__0(RabbitMqConnection connection) in d:\BuildAgent-02\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.RabbitMq\OutboundRabbitMqTransport.cs:line 87 
at MassTransit.Transports.ConnectionHandlerImpl`1.<>c__DisplayClass3.b__2() in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionHandlerImpl.cs:line 91 
at MassTransit.Transports.DefaultConnectionPolicy.Execute(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\DefaultConnectionPolicy.cs:line 42 
at MassTransit.Transports.ConnectionPolicyChainImpl.Next(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionPolicyChainImpl.cs:line 49 
at MassTransit.Transports.ConnectOnFirstUsePolicy.Execute(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectOnFirstUsePolicy.cs:line 34 
at MassTransit.Transports.ConnectionPolicyChainImpl.Next(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionPolicyChainImpl.cs:line 49 
at MassTransit.Transports.ConnectionHandlerImpl`1.Use(Action`1 callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionHandlerImpl.cs:line 86 
at MassTransit.Transports.RabbitMq.OutboundRabbitMqTransport.Send(ISendContext context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.RabbitMq\OutboundRabbitMqTransport.cs:line 50 
at MassTransit.Transports.Transport.Send(ISendContext context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Transport.cs:line 50 
at MassTransit.Transports.Endpoint.Send[T](ISendContext`1 context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Endpoint.cs:line 110 
 
___________________________________ 
rabbitmq://localhost/FilesVersioning => Publish not confirmed before channel closed 
___________________________________ 

I send the message at the end of a web request in a HttpModule.

Does anyone know what does this error mean?

As far as I know, I don't close anything related to MassTransit.

As far as I see, it throws in this lamda:https://github.com/phatboyg/MassTransit/blob/master/src/Transports/MassTransit.Transports.RabbitMq/OutboundRabbitMqTransport.cs#L51


I initialize the service bus like that:

        var _bus = ServiceBusFactory.New(sbc =>
        {
            sbc.UseRabbitMq();
            sbc.ReceiveFrom("rabbitmq://localhost/queue0");
            sbc.ReceiveFrom("rabbitmq://localhost/queue1");
            sbc.ReceiveFrom("rabbitmq://localhost/queue2");
            sbc.Validate();
            sbc.Subscribe(a => a.Handler<Item0>((msg, item) => new Item0Handler().Handle(msg)));
            sbc.Subscribe(a => a.Handler<Item1>((msg, item) => new Item1Handler().Handle(msg)));
            sbc.Subscribe(a => a.Handler<Item2>((msg, item) => new Item2Handler().Handle(msg)));
        });

...and I use the _bus to both send and receive messages.

I am a begginer in MassTransient, so this configuration might be wrong too...

 

Dru Sellers

unread,
Mar 26, 2014, 2:43:58 PM3/26/14
to masstrans...@googlegroups.com
Well, you can only call 'ReceiveFrom' once.


--
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/2fd946c4-8f5d-4727-b95f-c17c134e93b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dru Sellers

unread,
Mar 26, 2014, 2:45:12 PM3/26/14
to masstrans...@googlegroups.com
and you can collapse all of your Subscribe call into one call like

sbc.Subscribe(a => 
{
    a.Handler<Item0>(etc...
    a.Handler<Item1>(etc...
    a.Handler<Item2>(etc...
});

Chris Patterson

unread,
Mar 26, 2014, 4:43:32 PM3/26/14
to masstrans...@googlegroups.com
When you see this message, it indicates that the connection to RabbitMQ has been severed before the RabbitMQ server acknowledged the message. You may look at the RabbitMQ logs to see if it forced the closure of a connection for any reason (invalid exchange or something). Also, you might enable MT logging (using either NLog or log4net) to see what is happening. Also, make sure that you don't have any invalid or mismatched exchange or queue types, as when the client declares an exchange if there is an existing exchange that conflicts (such as temporary, exclusive, etc.) it will force the connection to close.

Also, make sure you are not disposing of the IEndpoint/IServiceBus instance from another web request.



kouko...@gmail.com

unread,
Mar 27, 2014, 3:56:42 AM3/27/14
to masstrans...@googlegroups.com
Thanks a lot everyone! :)

Do I really need to make a new service bus instance for each queue ?
I was trying to avoid this until now.
But, if it is nessesary, I will do it (It doesn't throw any errors when I do so, and this makes me currious).

kouko...@gmail.com

unread,
Mar 27, 2014, 4:31:48 AM3/27/14
to masstrans...@googlegroups.com
I see that in my RabbitMQ logs there are some errors like that:

=ERROR REPORT==== 26-Mar-2014::17:33:05 ===
connection <0.230.0>, channel 1 - soft error:
{amqp_error,not_found,"no exchange 'FilesVersioning' in vhost '/'",
            'basic.publish'}


I don't know if there fact that my code runs as an ASP.NET app in IIS has anything to do with this (permissions etc).

kouko...@gmail.com

unread,
Mar 27, 2014, 7:08:20 AM3/27/14
to masstrans...@googlegroups.com
Using just one queue seems to solve the problem.

Something else that I can't understand is why I should do this (GetEndpoint):
Bus.GetEndpoint(new Uri(_commitQueue)).Send(...)
..before Send(), if there is only one queue per bus... :(

Dru Sellers

unread,
Mar 27, 2014, 11:04:09 AM3/27/14
to masstrans...@googlegroups.com
re: bus.GetEndpoint

There are two general classes of messages that we tend to talk about 'Commands' and 'Events' 

Commands are typically handled by a specific 'agent' and it has an address so you need to send the message to that 'agent'
bus.GetEndpoint(_commandHandlerUri).Send(someCommand);

Events are 'broadcast' so that any one can handle them.
bus.Publish(someEvent);

So commands need an address and events don't.

---
As more context, at my company we run 20+ 'agents' each one tends to respond a few command messages and may listen to a variety of events. Each agent has its own inbound address.

Agent here is just an instance of a business contextual code + the bus that facilitates communication.

---

Hope that helps.

-d


--
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.

kouko...@gmail.com

unread,
Mar 27, 2014, 11:41:16 AM3/27/14
to masstrans...@googlegroups.com
Thanks a lot. :)
I think the whole thing it is clearer to me now.

Tom

unread,
Sep 16, 2015, 3:32:24 AM9/16/15
to masstransit-discuss
Hello Chris,

In case of temporary network issues, corrupted messages etc. Will Publish method retry couple of times to publish message before it will throw and exception (for example Publish not confirmed before channel close) or just once? And we should handle all errors and retries on our own?

Thank you,
Tom
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

--
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-discuss+unsub...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages