1

I have an application written in Python (PIKA) and C# (official NuGet package). Those applications are publishing new messages into RabbitMQ queues.

Until now, I used this syntax to publish a new message into the queue:

model.BasicPublish(exchange, routingKey, basicProperties, body);

I found that BasicPublish function always returns with success. I also read in RabbitMQ documentation that in case of broker destroyed, the messages that didn't send yet will be removed without sending it to RabbitMQ.

I want to avoid the loss of messages. So, I found 3 options to submit those messages to publish:

  1. Transaction - Very slow.
  2. Confirmation - I found it tricky to implement in a multi-threaded environment.
  3. with REST API - What do you think about that?

I think that it will be ideal for me yo use REST API for inserting messages into queues.

The Question:

The way that I found to send a message with API is to send POST message to this endpoint:

http://localhost:15672/api/exchanges/vhost/amq.default/publish

As you can see, this port (15672) belongs to the RabbitMQ management system.

  1. Is this the right way to use RabbitMQ with REST API?
  2. Can I trust the RabbitMQ management system in the production environment?
  3. Can you recommend an alternative to REST API that will accept to message enqueue immediately after insertion (blocking)?
1
  • You cannot do high throughput with the REST API , i would strongly recommend to use Publisher Confirm which is the second option outlined by you . Implementation should not be complicated , give it a shot and if something does not work , stackoverflow is there for rescue :-) Commented Sep 10, 2019 at 14:21

1 Answer 1

1

No, don't use the HTTP API. It is not intended for production use for publishing or consuming messages.

You must use publisher confirms. The technique described in this tutorial applies to the .NET client library as well.

You could also investigate libraries written on top of the official .NET library that may correctly implement publisher confirms for you. EasyNetQ is one such library.

Another good resource to read with concern to 100% reliability is this blog post.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.