NServiceBus with MSMQ

176 views
Skip to first unread message

Zahid Nawaz

unread,
Jun 20, 2017, 9:31:04 AM6/20/17
to Particular Software
Hi Everybody

I am experimenting the new version of NServicsBus. I find following step by step sample on particular site.

Can any one tell me how to configure MSMQ for Transport. Here is my scenario.

1. Client create message
2. Client message should be stored in MSMQ
3. Server Application running on same machine which subscribe the message.
4. Server handler get message from MSMQ and process it further. i.e Store in DB or send to other web service.
5. Retry to process message if it does not worked first time
6. after 3 retries send message to error queue

How do i configure this sample to use MSMQ for my scenario.

Helpful information to include
Product name:NServiceBus.Core
Version: 6.3.4
Stacktrace:
Description:

Indu Alagarsamy @ Particular.net

unread,
Jun 20, 2017, 4:59:18 PM6/20/17
to Particular Software
Hi,

For all your endpoints:
In order to use MSMQ as your transport, you'll need to set the transport to MSMQ instead of the learning transport (which is the default).
 
i.e. endpointConfiguration.UseTransport<MsmqTransport>();


You'll need to also set a persistence other than LearningPersistence. If you're just testing, you can use the InMemoryPersistence.
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
For production purposes, NServiceBus supports several persistence options such as Sql Persistence, NHibernate, etc, See: https://docs.particular.net/nservicebus/persistence/

In the subscriber endpoint, make sure you have the error forwarding on by adding:
endpointConfiguration.SendFailedMessagesTo("error");

The subscriber endpoint will also need to subscribe to the event. To do this:

 var transport = endpointConfiguration.UseTransport<MsmqTransport>();
        var routing = transport.Routing();
        routing.RegisterPublisher(
            eventType: typeof(OrderPlaced),
            publisherEndpoint: "Samples.StepByStep.Server");


This should get you going with the Step by Step sample to use MSMQ. 

You can also check out the pub/sub sample which uses MSMQ by default: https://docs.particular.net/samples/pubsub/

Hope this helps you. Let us know if you have further questions. 
I'll discuss with the team on how we can make this more clearer on our documentation. 

Thanks,
Indu Alagarsamy
Particular Software

Indu Alagarsamy @ Particular.net

unread,
Jun 28, 2017, 4:20:11 AM6/28/17
to Particular Software
Hi,

I just wanted to reach out and see how you're doing with the MSMQ sample. Hope my previous post was helpful.
We have now made our documentation more clear by adding a simple example of how to use the MSMQ Transport. (see: Simple MSMQ Transport usage)

Also, feel free to reach out to us if you need help with a Proof of concept help, and one of our solution architects will be more than happy to take a look at your design and guide you. See: https://particular.net/proof-of-concept

Cheers,
Indu Alagarsamy
Particular Software
Reply all
Reply to author
Forward
0 new messages