You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/09 18:08:45 UTC

[GitHub] [pulsar-client-go] merlimat commented on issue #614: Question about Connection Pool Close() function implementation

merlimat commented on issue #614:
URL: https://github.com/apache/pulsar-client-go/issues/614#issuecomment-916323538


   @tech4gk A single `Connection` object (and its underlying TCP socket) can be shared across multiple producers and consumers.
   
   When a producer/consumer gets closed, that won't affect the status of the `Connection`. Rather, when the connection gets closed (eg: in reaction of the underlying TCP socket being closed), it's correct to get it out of the pool, because at that point it cannot be reused anymore.
   
   > a. Create the client once when the client app initialize, with the MaxConnectionsPerBroker setting to a preferred configuration
   
   Yes, the application is expected to create a single Client instance throughout its lifecycle
   
   > b. Create the producer or consumer once when the client app initializes
   
   There are many different approaches there. For example you could create a producer at the first time you're going to use it. After that, the producer instance is designed to be "long-lived", and be used to published many messages.
   
   >  Call the close method on producer when the client app shuts down
   
   Yes, or when the producer is not going to be needed anymore
   
   > Call the close method on Client when the client app shuts down
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org