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

Open
#38 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, rabbitmq

Research direction

Start with the RabbitMQ direct reply-to documentation and the rmqcpp createConsumer call shown in the issue, especially replyToConsumerConfig and MessageGuard. Determine whether the library exposes noAck for this consumer type and compare that behavior with the broker error. Done means the supported configuration or limitation is clearly established and documented.

Written by the indexing model from the issue text.

Description

enhancement

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?

Dominant language
C++
Stars
106
Forks
32
Avg merge
9h 6m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bloomberg/rmqcpp

All issues in bloomberg/rmqcpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.