0

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.

San Jaisy
  • 15,327
  • 34
  • 171
  • 290

2 Answers2

0

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

Ashim
  • 411
  • 1
  • 8
  • 17
  • Well this is not working for me with micronaut 2.5.5 java 16 you can check on this repo https://github.com/anandjaisy/micronautRabbitMq and I have filled an issue here https://github.com/micronaut-projects/micronaut-rabbitmq/issues/241 – San Jaisy Jun 13 '21 at 05:40
0

This issue has now been fixed in this https://github.com/micronaut-projects/micronaut-core/issues/5588

San Jaisy
  • 15,327
  • 34
  • 171
  • 290