amqp / rhea

A reactive messaging library based on the AMQP protocol
Apache License 2.0
279 stars 79 forks source link

Using release on receiver leads to error #417

Closed Justgo13 closed 6 months ago

Justgo13 commented 6 months ago

So I am doing context.delivery.release({ undeliverable_here: true, delivery_failed: true }) but i get the following error Received disposition with role=receiver delivery-id=0 settled=true: unsupported outcome=modified when watching the error event handler.

I have autoaccept set to false as well Any idea why this could be happening?

For some context, I am trying to have the receiver read the messages without consuming them and deleting it from our messaging queue

grs commented 6 months ago

To 'browse' the queue, you can use the 'copy' distribution mode,assuming your broker supports it. E.g. when creaing the receiver do something like this open_receiver({source:{address:'my-queue',distribution_mode:'copy'}})

As for the error itself, it is hard to say without more detail (run with DEBUG=rhea* for more logging if you have a simple reproducer). One possibility is that you have not disabled autoaccept when creating the receiver, so the library is accepting the message on your behalf and then you are trying to release it. The other would be that the broker doesn't support the release mechanism.

Justgo13 commented 6 months ago

The distribution_mode attribute worked for me thank @grs