lerenn / asyncapi-codegen

An AsyncAPI Golang Code generator that generates all Go code from the broker to the application/user. Just plug your application to your favorite message broker!
Apache License 2.0
78 stars 21 forks source link

"nats: message does not have a reply" - Ack/Nak spam #183

Closed nuttert closed 3 months ago

nuttert commented 3 months ago

Hey! I got the spam after updating on the last version

3:24PM INF > error on ack message: "nats: message does not have a reply"

I see that subscribers use this logic:

acknowledgeableBrokerMessage.Ack()

I have an application that on one side uses Go(oapi + asyncapi) and on the other side there is another client/server that uses some broker natively, so the other side doesn't know the logic with acks, maybe I didn't understand the logic with acks/naks correctly , but I think this should be optional.

And it would be great if you add more about it in the Readme, thanks.

lerenn commented 3 months ago

Hello ! Sorry about that :/

It should be optional, so I may have missed something on this. I'll take a look on this as soon as I can.

@magraef, if you have any idea, please do not hesitate :)

magraef commented 3 months ago

@lerenn Sure i will take a loot at it.

@nuttert Just to be sure, you are using core NATS without jetstream right?

The general idea of the ack (acknowledgement) is to track the delivery and processing of a message from consumers to the broker and to trigger a redelivery of the message in the case of a nack.

magraef commented 3 months ago

If you could confirm that it's core NATS without Jetstream, it seems I misunderstood the NATS code documentation. From NATS Jetstream documentation i can see In this scenario, core NATS does not support ack() for messages, only Jetstream does.

Apologies for the confusion. I'm primarily accustomed to using Kafka and relied on the code documentation of natsio to implement the ack/nack mechanism. I will work on providing a fix and change the AcknowledgementHandler promptly.

In the meantime I would recommend to go back to the old version or if this is not wanted use the DummyLogger for the broker controller to get rid of the spam log messages.

It seems also that we dont see the log messages in our tests, because we do not configure a proper logger and run the test with the default DummyLogger.

nuttert commented 3 months ago

Yes, I used the core NATS. By the way, after this problem I became interested in Jetstreams (acks is a really good feature) and found some problems with it, I will describe them in the next issue. And thanks for your quick replies!