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 2019/11/06 02:49:57 UTC

[GitHub] [pulsar-client-go] xujianhai666 commented on issue #69: [ISSUE #68][feat]add Option config for init (#68)

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:
users@infra.apache.org


With regards,
Apache Git Services