Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable noAck while utilizing direct reply-to functionality? #38

Open
Pasick opened this issue Feb 6, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@Pasick
Copy link

Pasick commented Feb 6, 2024

I'm trying to implement the Direct Reply-to feature:

class ReplyToMessageConsumer {
  private:
    bool processMessage(const rmqt::Message& message)
    {
        std::string payload((const char *)message.payload(), message.payloadSize());
        std::cout << "Message was consumed: " << payload << std::endl;
        return true;
    }

  public:
    ReplyToMessageConsumer() {}
    void operator()(rmqp::MessageGuard& messageGuard)
    {
        if (processMessage(messageGuard.message())) {
            messageGuard.ack();
        }
        else {
            messageGuard.nack();
        }
    }
};
...
rmqt::QueueHandle replyToQueue = topology.addPassiveQueue("amq.rabbitmq.reply-to");
rmqt::Result<rmqa::Consumer> replyToConsumerResult =
    vhost->createConsumer(
        topology,
        replyToQueue,
        ReplyToMessageConsumer(),
        replyToConsumerConfig
    );

However RMQ broker reports an error:

2024-02-06 12:01:03.888100+00:00 [error] <0.1343.0> operation basic.consume caused a channel exception precondition_failed: reply consumer cannot acknowledge

How do I set noAck = false?

@willhoy
Copy link
Contributor

willhoy commented Jul 17, 2024

II think we'd need to support this use case better since I believe:
'The RPC client must consume in the automatic acknowledgement mode.'
excerpt from https://www.rabbitmq.com/docs/direct-reply-to#limitations

Because auto-ack isn't what we consider "reliable message delivery" this would be an extension to the scope of this library.

@willhoy willhoy added the enhancement New feature or request label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants