merlimat commented on a change in pull request #69: [ISSUE #68][feat]add Option
config for init (#68)
URL: https://github.com/apache/pulsar-client-go/pull/69#discussion_r342866157
##########
File path: examples/consumer-listener/consumer-listener.go
##########
@@ -34,15 +34,9 @@ func main() {
channel := make(chan pulsar.ConsumerMessage, 100)
- options := pulsar.ConsumerOptions{
- Topic: "topic-1",
- SubscriptionName: "my-subscription",
- Type: pulsar.Shared,
- }
-
- options.MessageChannel = channel
-
- consumer, err := client.Subscribe(options)
+ consumer, err := client.Subscribe("my-subscription",
pulsar.WithTopics("topic-1"),
+ pulsar.WithSubscriptionType(pulsar.Shared),
+ pulsar.WithMessageChannel(channel))
Review comment:
To me it seems the proposed syntax is more verbose and less descriptive at
the same time. For example, given a different name, it might become more
difficult that `"my-subscription"` is a subscription name and not a topic name.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services