Open HustonMmmavr opened 5 months ago
hi @HustonMmmavr , The offset is outside the message context, so this information cannot be added to the message. The other clients have the same behaviour.
Having a channel on the consumer side with all the information is correct, as you have done.
maybe it's worth to add the ability for user to interact with channel based approach
That was the intention for the version 2.x of this client, but at the moment, the implementation is blocked due to other priorities.
You could propose a PR if you like, but it can be unclear whether the user has two ways to consume the messages.
Is your feature request related to a problem? Please describe.
Hello!
In my project I've to manually track offsets. It's done in a different (main) goroutine, while the consumer callback is called in it's own goroutine, so due to async nature i can't rely on
consumer.Offset
tracking outside of consumer routine, so I have to do something like that:The output is next:
Also, as I saw in library - the consumer routine works with array of offsetMessages, where offsetMessage - pointer to *amqp.Message and offset. As a result there are two unnecessary wraps. Maybe it's worth to send offsetMessage to the callback, or extend the amqp.Message with the offset field (like it's done inside amqp lib DeliveryTag field).
Here is an amqp-code:
It's output is next:
Describe the solution you'd like
Maybe it's worth to make api of amqp Messages similar to amqp library or extend current amqp message with new Offset field. And the second proposal: maybe it's worth to add the ability for user to interact with channel based approach, like it's done inside amqp lib (for ex create new API method that will return consumer channel to user application)
Describe alternatives you've considered
No response
Additional context
No response