Now that we have covered a lot of the introductory material for RabbitMQ, this part of the series will look at developing software to interact with the message broker as both a producer and a consumer. First we will take a look at the RabbitMQ client library. Then we will introduce the business scenario used for the sample applications. Before we start looking at the individual examples we will take a quick look at the common code shared between them. Then we will move onto the actual code examples themselves.
The code for this series can be found here.
These example will include:
- Basic queues
- Worker queues
- Publisher and subscribers
- Direct routing of queues
- Topic based publisher and subscribers
- Remote procedure calls
RabbitMQ client library
To develop software against RabbitMQ you will need to install the RabbitMQ client library for .NET. Before we look at how to install the client library, let’s take a brief look at what it is. This series will not serve as an in-depth guide to the whole client library API. You can read a more in-depth document for the client library that explains the full library from the RabbitMQ site. This section will serve as an introduction to the library and the examples in the rest of this series will help you cement your understanding further.
What is contained in the Client Library?
The RabbitMQ .NET client is an implementation of an AMQP client library for C# and other .NET languages. The client library implements the AMQP specification 0-8 and 0-9. The API is closely modeled on the AMQP protocol specification with little additional abstraction, so if you have a good understanding of the AMQP protocol, then you will find the client library easy to follow.
The core API interfaces and classes are defined in the RabbitMQ.Client namespace. The main API interfaces and classes are:
- IModel : This represents an AMQP data channel and provides most of the AMQP operations.
- IConnection : represents an AMQP connection.
- ConnectionFactory: constructs IConnection instances.
Some other useful interfaces and classes include:
- ConnectionParamters: configures a ConnectionFactory.
- QueueingBasicConsumer: receives messages delivered from the server.