Enqueueing from RabbitMQ queues
RabbitMQ is a great way to communicate between different applications. But sometimes you want to have more visibility into queue messages, when they're processed and if they fail. And to be able to retry in a controlled fashion when they fail.
Nexus lets you get the best of both worlds by automatically enqueueing from a RabbitMQ queue to a Nexus queue like this:
builder.Services
.AddNexus()
.AddQueues()
.AddRabbitMq(options =>
{
options.UserName = "...";
options.Password = "...";
options.HostNames = ["localhost"];
// Or:
options.ConnectionString = new Uri("amqp://...");
})
.AddNexusRabbitMqQueues()
.EnqueueFrom<RabbitQueueMessage>(new NexusRabbitMqQueue
{
Name = "rabbit_queue",
Bindings = [new NexusRabbitMqQueueBinding
{
ExchangeName = "my_exchange",
RoutingKey = ""
}]
});
In order to use this you need to install the NuGet package for RabbitMQ called CommerceMind.Nexus.RabbitMQ
.