RabbitMQ Backends for .NET
The .NET Agent automatically detects RabbitMQ backends based upon calls from instrumented tiers. RabbitMQ exit points are methods that publish or push messages to a queue. RabbitMQ entry points are methods that listen or poll for new messages in the queue.
If you are using NServiceBus over the RabbitMQ transport, see NServiceBus Backends for .NET.
Exit Points and Backend Naming
The agent discovers a RabbitMQ backend exit point when your application sends a message to the queue using the BasicPublish()
By default, the agent names the RabbitMQ backend for the exchange parameter of the BasicPublish()
For example:
model.BasicPublish("MyExchange", "", false, false,
basicProperties, Encoding.UTF8.GetBytes(message));In this case the agent names the queueMyExchange.
You can refine the backend name to include some or all segments of the routing key. To configure RabbitMQ naming you must be familiar with your implementation RabbitMQ exchanges and routing keys. See RabbitMQ Exchanges and Exchange Types.
Refine backend naming
Register thermqsegmentsnode property. For instructions on how to set a node property, see App Agent Node Properties.
Name: rmqsegmentsDescription: "Configure RabbitMQ naming to include routing key segments."Type: IntegerValue: <integer>The routing key is a string. The agent treats dot-separated (".") substrings of the routing key as segments. Set the value to an integer that represents the number of routing key segments to include in the name.
In the following example the routing key is "abc.def.ghi". Set the rmqsegments value to "2" to name the queue "MyExchange.abc.def".
model.BasicPublish("MyExchange", "abc.def.ghi", false, false,
basicProperties, Encoding.UTF8.GetBytes(message));
After you save the node property, the Controller sends the configuration to the agent. After some time the RabbitMQ backend shows up with the new name.
Entry Points
The agent discovers RabbitMQ backend entry point when your application polls the queue. Splunk AppDynamics auto-detects RabbitMQ based upon the following patterns:
BasicGet Method
The agent detects the pattern below where the application periodically polls the message queue using the BasicGet() while BasicGet BasicGet if
RabbitMQ Client before version 6.x:
while (true)
{
var result = channel.BasicGet("MyExchange", true);
if (result != null)
{
var body = result.Body;
var message = Encoding.UTF8.GetString(body);
Console.WriteLine("Received: {0}.", message);
}
Thread.Sleep(5000);
}
RabbitMQ Client version 6.x:
while (true)
{
var result = channel.BasicGet("MyExchange", true);
if (result != null)
{
var body = result.Body.ToArray()
var message = Encoding.UTF8.GetString(body);
Console.WriteLine("Received: {0}.", message);
}
Thread.Sleep(5000);
}
HandleBasicDeliver Method
The agent detects the HandleBasicDeliver() IBasicConsumer HandleBasicDeliver