Upgrading from MT 2.9.5 to latest

95 views
Skip to first unread message

Jamie Flint

unread,
Nov 9, 2016, 7:07:37 AM11/9/16
to masstransit-discuss
I have a whole bunch of questions about this, currently we use MassTransit with RabbitMQ very heavily within an application. I've been tasked with updating MT to the latest version.

Currently we have 3 parts to the App, an IIS MVC web app, a gateway service and a farm layer (multiple instances of the same service)

Starting with the web app we only used 1 Service bus and it was set up to use the singleton Instance in Bus.cs. This doesn't appear to be available in MT3, not sure how I should be handling this going forwards, for now I've set up our own singleton wrapper for it.

For this singleton Bus we currently have the consumers registered using Bus.Instance.SubscribeInstance(). 
In MT3 I see there's

 IRabbitMqBusFactoryConfigurator.ReceiveEndpoint(IRabbitMqHost host, string queue, Action<IRabbitMqReceiveEndpointConfiguratior> configure)

For the Action<IRabbit...> I see I can use either ep.Consumer() or ep.Instance(object instance). I'm not sure if either of these are correct. 
Then there's also IBus.ConnectConsumer() and IBus.ConnectInstance(). Again I am not sure if I should be using these or the ReceiveEndpoint functions. 

On the gateway service we have 5 buses set up, each with 1 consumer, the consumer being set on the bus using IServiceBus.SubscribeConsumer(), 
These consumers have a non-standard constructor which takes the bus instance as a parameter, therefore they are subscribed after the bus has been
initialized. Because of this the ReceiveEndpoint() functions can't work as the bus is still being initialized, this leaves just the ConnectConsumer() or ConnectInstance() functions, 
again I am not sure which I am meant to be using here. 

Lastly for the farm services the consumers are being subscribed using ServiceBusConfigurator.Subscribe( subs => subs.Instance(new Consumer() ); Again I am unsure which function I should be using to set these consumers up with. 

From the above I have tried using what appears to be the most suitable options however I can't get it to all to work.
In the RabbitMq web admin UI I can see the exchanges for each consumer however they are missing the normal binding onto the relevant queue, and these queues aren't even being created.
When using MT2 the Exchange for the Message is bound to send to an Exchange with the same name as the queue, and that exchange is bound to the queue with the same name. I am not seeing this with MT3. 

Additionally another thing that seem to have been removed that we use are SerivceBusConfigurator.EnableRemoteIntrospection(), have I missed something or is this gone?

Dru Sellers

unread,
Nov 9, 2016, 8:31:16 AM11/9/16
to masstrans...@googlegroups.com
Good morning,

I'm going to let Chris do the bulk of the answering, but I'd like to explore one point in particular with you.

These consumers have a non-standard constructor which takes the bus instance as a parameter, therefore they are subscribed after the bus has been
initialized.

Why are they taking the bus in their ctor?

I ask because I think I can help get you to the right point but want to make sure I'm addressing your needs.

-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-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/0c917ad5-5327-4823-88d3-cfc1106ff240%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jamie Flint

unread,
Nov 9, 2016, 8:42:45 AM11/9/16
to masstransit-discuss
Why are they taking the bus in their ctor?

The gateway acts as a proxy between the web app and the farm services, when the gateway receives a message from the web app it then passes on to all the farm services, when these farm services respond the gateway consumer uses the bus the consumer is registered to to respond to. The same bus is used for communicating to both farm and web from the gateway, just with different messages. All of this was written almost 3 years ago long before my time working on this app (only a couple of months). 
To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Nov 9, 2016, 10:08:36 AM11/9/16
to masstrans...@googlegroups.com
First, there is a document on upgrading which I'm sure you've reviewed.

The ConnectInstance methods (and related consumer and handler) do not bind exchanges to the bus endpoint. Only receive endpoints bind exchanges to the queue. So they won't work for your needs.

You should have a single bus for your app which it seems you've handled. MassTransit doesn't have a singleton anymore because it's an app concern and was used too often incorrectly.

You should create your receive endpoints at startup for your consumers. The next version has the ability to connect new receive endpoints to the host after the bus has started. So that might help you porting your app. 

Your consumers should never need the IBus, they should always use the ConsumeContext for any sends or publishes to other endpoints.

Also don't cache or pass ISendEndpoint instances to constructors either - get them from the Consume context. 

__
Chris Patterson




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.

Jamie Flint

unread,
Nov 10, 2016, 5:40:09 AM11/10/16
to masstransit-discuss
Thanks, I think I'm getting closer, consumers have been moved to respond using the context and don't take in a bus param any more,  but I'm still not seeing the queues being created.

Here's an example of one of the consumers, https://gist.github.com/lutzee/9354588cf3d9c24d5843268f028deb58

For MT2 what I see in RabbitMq is an exchange for the ReportRequest Type, which is bound to an Exchange for the ReportQueue, which is bound to the Queue for the ReportQueue which has a consumer listening on that queue for the ReportRequest Messages.

For MT3 all I am seeing is the Exchange for the ReportRequest Type with no exchange for the ReportQueue and no ReportQueue either. 

Chris Patterson

unread,
Nov 10, 2016, 8:11:36 AM11/10/16
to masstrans...@googlegroups.com
Doesn't look like you're calling Start(), to start the bus and consumers. Otherwise it looks close. 

Also the filters for concurrency and rate limit need to be inside the receive endpoint and before the consumer is declared. 

__
Chris Patterson




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.

Jamie Flint

unread,
Nov 10, 2016, 9:11:05 AM11/10/16
to masstransit-discuss
Right, spotted just spotted start() is in the transition doc, I must have missed it.
I can now see all the queues are there, however all the messages are ending up in a _skipped queue and the consumer isn't picking it up, what would be causing that?

Jamie Flint

unread,
Nov 10, 2016, 9:43:24 AM11/10/16
to masstransit-discuss
Oops, that was my bad, had a 2 Endpoints with the same queue name, messages are now sending.

It also seems that bool Accept() has been removed. Is there a replacement for this? We do extra checks per message type, or should we just move these checks to the top of Consume()?

Chris Patterson

unread,
Nov 10, 2016, 12:31:45 PM11/10/16
to masstrans...@googlegroups.com
Yeah, those accept checks would just be in your consumer now, as the old interface did the same thing anyway. And it was super confusing for most developers.

Sounds like you're almost there!


To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@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+unsubscribe...@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+unsubscribe...@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.

Jamie Flint

unread,
Nov 11, 2016, 10:11:49 AM11/11/16
to masstransit-discuss
Seems like it! Still having some issues passing on messages in the gateway consumers though.
Essentially I am doing the following:


 
public async Task Consume(ConsumeContext<ReportRequest> context)
 
{
 
var message = context.Message;


 
var farmReportRequest = new FarmReportRequest
 
{
 
CorrelationId = incomingrequest.CorrelationId,
 
MessageType = incomingrequest.MessageType,
 
OriginalRequest = incomingrequest
 
};
 
 context
.Publish(farmReportRequest);
 
}

However I am not seeing the FarmReportRequest messages in rabbit, the exchanges and queue is there for them with the consumers from the farm service connected up, but no messages are passes to the farm queue. What am I missing/doing wrong?
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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/cb89a9a9-304d-4a03-9857-ec3c8614ef0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

Jamie Flint

unread,
Nov 18, 2016, 10:11:19 AM11/18/16
to masstransit-discuss
Any further help with this? 

Thanks.
Reply all
Reply to author
Forward
0 new messages