xujianhai666 commented on issue #69: [ISSUE #68][feat]add Option config for 
init (#68)
URL: https://github.com/apache/pulsar-client-go/pull/69#issuecomment-550118047
 
 
   > I've seen this patten in some other places for example helm 
https://github.com/helm/helm/blob/master/internal/experimental/registry/client.go
 and https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis. 
The main thing in these implementations are the config functions are scoped 
into their own package. This patch seems to be mixing config functions for 
three different configs with the same package. This is confusing to me.
   > 
   > One option would be to prefix everything to make it clear which config it 
belongs to.
   > ConsumerOptionsTopic()
   > ConsumerOptionsAckTimeout(1000)
   > Subscribe(name string, ConsuerOptionTopic(), ConsumerOptionsAckTimeout())
   > 
   > However this could quickly become more verbose than the standard way.
   > 
   > opts := ConsumerOptions{
   > topic: "my-topic",
   > ack: 1000,
   > }
   > Subscribe(name string, opts)
   > 
   > Thoughts?
   
   
   
   > I've seen this patten in some other places for example helm 
https://github.com/helm/helm/blob/master/internal/experimental/registry/client.go
 and https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis. 
The main thing in these implementations are the config functions are scoped 
into their own package. This patch seems to be mixing config functions for 
three different configs with the same package. This is confusing to me.
   > 
   > One option would be to prefix everything to make it clear which config it 
belongs to.
   > ConsumerOptionsTopic()
   > ConsumerOptionsAckTimeout(1000)
   > Subscribe(name string, ConsuerOptionTopic(), ConsumerOptionsAckTimeout())
   > 
   > However this could quickly become more verbose than the standard way.
   > 
   > opts := ConsumerOptions{
   > topic: "my-topic",
   > ack: 1000,
   > }
   > Subscribe(name string, opts)
   > 
   > Thoughts?
   
   @cckellogg I know ur question, It is a really big problem, I have no good 
solution for that now. maybe this pr should be pending for some time to find 
effective solution

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to