title | summary | reviewed | component | related | redirects | ||
---|---|---|---|---|---|---|---|
RabbitMQ Transport Scripting |
Example code and scripts to facilitate deployment and operational actions against RabbitMQ. |
2020-09-03 |
Rabbit |
|
|
Example code and scripts to facilitate deployment and operational actions against RabbitMQ.
These samples use the RabbitMQ.Client NuGet Package.
Since the RabbitMQ.Client is not CLS Compliant it is not possible to run this code within PowerShell.
A send involves the following actions:
- Create and serialize headers.
- Write a message body directly to RabbitMQ.
snippet: rabbit-nativesend
snippet: rabbit-nativesend-usage
In this example, the value MyNamespace.MyMessage
represents the .NET type of the message. See the headers documentation for more information on the EnclosedMessageTypes
header.
This code shows an example of how to perform the following actions:
- Read a message from the error queue.
- Extract the failed queue from the headers.
- Forward that message to the failed queue name so it can be retried.
snippet: rabbit-return-to-source-queue
snippet: rabbit-return-to-source-queue-usage
Queue creation can be done for a specific endpoint or queues shared between multiple endpoints.
snippet: rabbit-create-queues
To create all queues for a given endpoint name.
snippet: rabbit-create-queues-for-endpoint
snippet: rabbit-create-queues-endpoint-usage
snippet: rabbit-create-queues-shared-usage
To configure HA policy, refer to the RabbitMQ HA documentation.
snippet: rabbit-delete-queues
snippet: rabbit-delete-queues-for-endpoint
snippet: rabbit-delete-queues-endpoint-usage
snippet: rabbit-delete-queues-shared-usage