MassTransit and ASP.NET

187 views
Skip to first unread message

Jeff Doolittle

unread,
Jun 29, 2016, 7:04:11 PM6/29/16
to masstransit-discuss
I'm trying to integrate a web application with MassTransit where published messages can be sent to the bus, and request/response messages can be handled as well.

I have the basic scenario working fine when a client calls the bus directly such as

Console App (publisher) ==> Mass Transit ==> ConsumingService (subscriber)
and
Console App (requester) ==> Mass Transit ==> ConsumingService (replier) ==> Mass Transit ==> Console App (receiver)

I've also got publish working with an Asp.Net application (with both NancyFx and WebApi)
Web Client (POST publish) ==> Asp.Net (nancy or webapi) ==> Mass Transit ==> ConsumingService (subscriber)

What I *can't* get working is this (regardless of whether I use NancyFx or WebApi):
Web Client (POST request) ==> Asp.Net (nancy or webapi) ==> Mass Transit ==> ConsumingService (replier) ==> Mass Transit ==> Asp.Net ==> Web Client (receiver)

In the RabbitMQ management web application, I noticed that I'm getting and Exchange and a Queue for the Console app client. However, for the Asp.Net application, I get an exchange with no queue for the replies to go out through.

I can't figure out why there is not reply queue being created. All I get is a "MassTransit.RequestTimeoutException" which makes sense if there is no queue for handling the replies.

Does anyone have suggestions or ideas for why this isn't working and how to get it working?

I appreciate any help and insights that might be available from the group.

Thanks,

--Jeff

Alexey Zimarev

unread,
Jun 30, 2016, 1:48:47 PM6/30/16
to masstransit-discuss
Do you have a repo where you have this reproduced?

Travis Smith

unread,
Jun 30, 2016, 2:09:35 PM6/30/16
to masstransit-discuss
Do you create a bus instance on startup for the webapp? It if you create a bus instance and bind consumers to a queue, it should be creating the queues and exchanges. 

On Thu, Jun 30, 2016 at 10:48 AM Alexey Zimarev <azim...@gmail.com> wrote:
Do you have a repo where you have this reproduced?

--
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/1df385d8-2ce1-430a-b606-56791335d827%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
-Travis

Jeff Doolittle

unread,
Jun 30, 2016, 2:20:35 PM6/30/16
to masstransit-discuss
Yes, I'm creating it when the application starts up. Since everything works fine with the publish I can confirm that I'm actually creating a functioning bus. The issue is only on request/reply.

I'll work on getting a repo up today on github that demonstrates the problem.

--Jeff

Travis Smith

unread,
Jun 30, 2016, 2:21:52 PM6/30/16
to masstransit-discuss
Does your consumer get the request part of the request message? 

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

For more options, visit https://groups.google.com/d/optout.
--
-Travis

Jeff Doolittle

unread,
Jun 30, 2016, 2:26:36 PM6/30/16
to masstransit-discuss
Yes, the consumer receives the request. But since there is no reply queue created, the reply goes nowhere.

Chris Patterson

unread,
Jun 30, 2016, 3:19:23 PM6/30/16
to masstrans...@googlegroups.com
A couple of code snippets would really help here, particularly bus setup and the creation of the request client.


On Thu, Jun 30, 2016 at 11:26 AM, Jeff Doolittle <jeffdo...@gmail.com> wrote:
Yes, the consumer receives the request. But since there is no reply queue created, the reply goes nowhere.

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

Jeff Doolittle

unread,
Jun 30, 2016, 4:17:41 PM6/30/16
to masstrans...@googlegroups.com
I'm working on putting a little repo together that I can share.

You received this message because you are subscribed to a topic in the Google Groups "masstransit-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/masstransit-discuss/AMPgeoFpzqY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to masstransit-dis...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.

Jeff Doolittle

unread,
Jun 30, 2016, 4:36:46 PM6/30/16
to masstransit-discuss

Jeff Doolittle

unread,
Jun 30, 2016, 4:41:45 PM6/30/16
to masstransit-discuss
I added some explanation over on the gitter channel. Thanks everyone for being willing to help.

On Thursday, June 30, 2016 at 1:36:46 PM UTC-7, Jeff Doolittle wrote:
https://github.com/jeffdoolittle/MassTransitBridge

Chris Patterson

unread,
Jun 30, 2016, 4:45:27 PM6/30/16
to masstrans...@googlegroups.com
Be sure to .Start() the bus or it won't process the responses. And Stop() it on shut down of the AppDomain. 

__
Chris Patterson




On Thu, Jun 30, 2016 at 1:36 PM -0700, "Jeff Doolittle" <jeffdo...@gmail.com> wrote:

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

Jeff Doolittle

unread,
Jun 30, 2016, 5:19:51 PM6/30/16
to masstrans...@googlegroups.com
On snap <facepalm> Thanks Chris! Regarding the Appdomain, which event do I need to hook into for when an asp.net process completes? Is the following correct?

            AppDomain.CurrentDomain.ProcessExit += (o, args) =>
            {
                bus.Stop();
            };

Thanks Again,

--Jeff



You received this message because you are subscribed to a topic in the Google Groups "masstransit-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/masstransit-discuss/AMPgeoFpzqY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to masstransit-dis...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Jun 30, 2016, 5:37:17 PM6/30/16
to masstrans...@googlegroups.com
I think there is an Application_End method you can override for the web site. 

__
Chris Patterson




Reply all
Reply to author
Forward
0 new messages