rabbitmq-stream-go-client icon indicating copy to clipboard operation
rabbitmq-stream-go-client copied to clipboard

Add code documentation

Open gbl-tylers opened this issue 3 years ago • 4 comments

Request to add basic comments to public-facing functions, as well as better descriptions of how/where to close producers/consumers to improve usability as opposed to relying on examples that do everything in one function

gbl-tylers avatar Nov 25 '21 21:11 gbl-tylers

Hi @gbl-tylers Thank you for reporting. There is already the documentation: https://github.com/rabbitmq/rabbitmq-stream-go-client#overview

What part is not clear? Feel free to open a PR to improve the documentation btw.

Gsantomaggio avatar Nov 26 '21 08:11 Gsantomaggio

There's two particular issues/questions we had:

  • Connecting with a custom port (5553). underlying function defaults to 5552 instead, and we were not able to find exactly where this value was being inserted in, if it was in code or getting something from rabbitmq that we had not correctly configured
  • At which point we should close the consumer and if we are using this in an actual application, should we call the consumer in a go routine?

The documentation you linked is fine, it was more just when trying to integrate with what we had, it was a bit difficult as many functions / structs we used in the package didn't have any comments about how to use them

gbl-tylers avatar Nov 26 '21 16:11 gbl-tylers

Connecting with a custom port (5553).

It is in the https://github.com/rabbitmq/rabbitmq-stream-go-client#connect

  • SetPort(xxxx).

At which point we should close the consumer.

When you don't need to consume messages anymore.

and if we are using this in an actual application, should we call the consumer in a go routine?

It depends on your application. From the Client-side perspective, it does not change anything.

it was a bit difficult as many functions / structs we used in the package didn't have any comments about how to use them

We will add documentation on the functions

Gsantomaggio avatar Nov 29 '21 08:11 Gsantomaggio

Added the documentation "How to close the producer/consumer" via https://github.com/rabbitmq/rabbitmq-stream-go-client/commit/4fb561de60ebfb14cdbffd9054c794cc7f7fa638

Gsantomaggio avatar Dec 09 '21 11:12 Gsantomaggio