Using rabbitMQ with Micronaut latest version. On consumer both the parameter accepts the same value from the producer, however, I am sending the different value from the producer.

Output of consumer, since the value for categoryId and id are same

enter image description here

On the producer side I am sending the different value as below

  @RabbitProperty(name = "replyTo", value = "amq.rabbitmq.reply-to")
    @Binding(ConstantValues.COUNT_SUB_CATEGORY)
    Maybe<Long> Count(@MessageHeader String categoryId, String id);

enter image description here

The categoryId and id have a different value in the producer side

What is the mistake I am doing quite not sure about it.

2

There are 2 best solutions below

1
On

It's strange. I replicated this issue on my system too. And, this issue seems to go away when deprecated io.micronaut.messaging.annotation.Header is used.

Can you try that on your code too and see if it works ?

Your new code:

Producer:

@Binding(ConstantValues.COUNT_SUB_CATEGORY)
Maybe<Long> Count(@Header String categoryId, String id);

Consumer:

@Queue(......)
Long count(@Header("categoryId") String categoryId, String id) {
    ......
}

Tested using micronaut version 2.5.1, micronaut-rabbitmq 2.5.0, java 11

0
On