apache / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
650 stars 334 forks source link

Add support for batch receiving messages #892

Open kant777 opened 1 year ago

kant777 commented 1 year ago

I want to use a combination of receiver queue size and timeout but I dont see how to set timeout in the Golang client api where I can say buffer until 500ms if the receiver queue size is not full. This is very important for downstream OLAP databases which cannot handle fine grained writes.

This feature is really important and it's surprising that the Golang client API doesn't expose this.

michaeljmarshall commented 1 year ago

Thanks for creating this issue @kant777.

This feature is not yet in the go client. It is in the Java client with the receiveBatch() API and the BatchReceivePolicy configuration. It was added in PIP 38: https://github.com/apache/pulsar/wiki/PIP-38%3A-Batch-Receiving-Messages. For reference, we call this the "batch receiving messages" feature in our client feature matrix: https://docs.google.com/spreadsheets/d/1YHYTkIXR8-Ql103u-IMI18TXLlGStK8uJjDsOOA0T20/edit.

This feature makes sense in the Golang client. The only question is how to model it.

@kant777 - are you interested in contributing this feature?

kant777 commented 1 year ago

modeling should be straightforward in Go using channels and select. But what I am just not familiar with pulsar code in general so I would need to spend some time understanding that and also would need pointers. I just can't commit to it right now. As a temporary solution I can do this at the application level quite easily again using channels and select but will be great to have this in the driver.

g41797 commented 1 year ago

Looks the same as #840 Please clarify the status