rabbitmq / rabbitmq-stream-dotnet-client

RabbitMQ client for the stream protocol
https://rabbitmq.github.io/rabbitmq-stream-dotnet-client/stable/htmlsingle/index.html
Other
122 stars 41 forks source link

Expose Chunk info to MessageContext #331

Closed andreasolazzo-b52 closed 9 months ago

andreasolazzo-b52 commented 11 months ago

Is your feature request related to a problem? Please describe.

In my use case, I need to start consuming from the last message (included) of a stream at a given time, assuming no one is publishing to the stream at the same time. At the moment, the closest option is to start consuming from the first message in the last chunk, but there's no way to know when the actual last message is reached.

Describe the solution you'd like

Looking at the RawConsumer implementation, the information on Chunk ID and the number of entries/records is there, but it is not exposed to the client. With that information available in the MessageContext, along with the message offset, it would be possible to start consuming from the first message of the last chunk and "ignore" messages until the last one is reached, calculating it based on the number of entries/records of the chunk itself.

Describe alternatives you've considered

One other option would be to add either the exact offset of the last message or the number of entries/records of the last chunk to the StreamStats.

Additional context

No response

Gsantomaggio commented 11 months ago

Thank you for reporting the issue. We will evaluate it as soon as possible.

Gsantomaggio commented 9 months ago

@francescopessina87 and his team will provide a PR for this issue.

You can add the info to the context message.

Gsantomaggio commented 9 months ago

FYI: https://www.nuget.org/packages/RabbitMQ.Stream.Client/1.8.0-rc.3 Please try the version and let me know

francescopessina87 commented 9 months ago

@Gsantomaggio I tried the 1.8.0-rc.3 version and everything works as expected 👍