Getting started with NServiceBus, Request-Response example

Getting started with NServiceBus, Request-Response example

In this blog post we explain some request-response example that we mentioned in the previous blogpost.

Below you can see the first steps to do, before we really can start with sending some messages.

  – Go to à Downloads
  – Download the msi file under the “Get version 3.3.1 now” button.

   – Install the msi file on your system.
   –  Now you can find under “All programs > NServicebus v3.3.1” a Welcome to NServiceBus link.

You can click on the samples link to go to the samples. Or you can choose a sample below. We will talk about the “FullDuplex – RequestResponse” sample. Copy past the location of the sample and open it with visual studio. You will get the following solution.
The client is going to send a message to the server, the server will process the message and return it back to the client.
Let’s run the server and client application. You should see some screens like below.
Now we can exchange some messages between server and client. Let’s hit the “Enter” button in the Client Console. The client sends a message to the server with a Guid, which is received by the server and the server sends a message back to the client.
As you can see, this is not a real life scenario. What if the client is down? What if the server is down.
Let’s now start only the client application.
As you can see we send a message from the client to the server, but we don’t get some reaction back from the server because we didn’t start the server application. You don’t lose the message because NServicebus uses MSMQ and the message stays in the queue.
When we look in the MSMQ queue, you can see that there is a message.
Now we open the message, there you can find the DataID in the message. This ID is the same as on the Client application.
Now we can start the server application.
You can now see that the server picks up the message to process it. And send it back to the client.
I hope you enjoyed reading this blogpost.
Author: Sven Van den brande

Working at i8c

i8c is a system integrator that strives for an informal atmosphere between its employees, who have an average age of approx 30 years old. We invest a lot of effort in the professional development of each individual, through a direct connection between the consultants and the management (no multiple layers of middle management). We are based in Kontich, near Antwerp, but our customers are mainly located in the triangle Ghent-Antwerp-Brussels and belong to the top 500 companies in Belgium (Securex, Electrabel, UCB, etc…).

Quality Assurance

i8c is committed to delivering quality services and providing customer satisfaction. That’s why we invested in the introduction of a Quality Management System, which resulted in our ISO9001:2000 certification. This guarantees that we will meet your expectations, as a reliable, efficient and mature partner for your SOA & integration projects.

i8c - ISO9001-2015