vert-x3 / vertx-rabbitmq-client

Vert.x RabbitMQ Service
Apache License 2.0
73 stars 64 forks source link

No error is reported if basic.publish failed due to a non-existent exchange or permissions issue #123

Closed Ultranium closed 3 years ago

Ultranium commented 3 years ago

Version

Vert.x 4.0.2 JDK 15.0.1

Context

I found that calling basicPublish() with non-existent exchange or when the user doesn't have permissions to write to the exchange leads to succeeded() result.

Minimal reproducer

https://github.com/Ultranium/vertx-rabbitmq-send-reproducer

Steps to reproduce

  1. Start RabbitMQ server on localhost with default config
  2. Run the application
  3. "Message sent" lines will be printed in the console, as if the messages were successfully sent, while the RabbitMQ closes channels with the "404 NOT_FOUND - no exchange 'non-existent-exchange' in vhost '/'" error.

Extra

Wireshark capture: image

Yaytay commented 3 years ago

Your example does not use confirmations. Without confirmations Rabbit MQ is fire and forget, you won't know what happens to your message. You can either make your confirmations synchronous (waitForConfirms) or asynchronous (more complicated, but RabbitMQPublisher is set up to do it). Synchronous confirmations are clearly a lot simpler to work with, but they will hugely reduce your maximum message sending throughput.

For now, please can you add synchronous confirmations to your example and see what happens.

Ultranium commented 3 years ago

@Yaytay thanks for your reply.

Indeed, using the waitForConfirms() I can now check if a message was accepted buy RabbitMQ or not. I should've read the manual more carefully.

I just thought that if the RabbitMQClient throws an exception if it can't connect to a server, the same should happen for errors during sending messages, but now I see that this is not how it works.