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 · 0 comments
Open

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant