apache / apache/pulsar-client-go

Use ConfigOption withxxxx for simple usage

Open
#68 2 comments 0 reactions 1 assignee Claimed by @xujianhai666 View on GitHub
help wanted
Dominant language
Go
Stars
745
Forks
389
Avg merge
3d 20h
Merged PRs (30d)
3

Description

**Is your feature request related to a problem? Please describe.**
now, when we use client 、producer、consumer, we must provide `ClientOption`, `ProducerOption` and `ConsumerOption`, but there are many params on Option, which puzzle users.
according to Rob Pike: https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html and Dave cheney: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis , we should use WithXXX. for example:

```
type ClientOption func(opts ClientOptions)
func WithURL(URL string) ClientOption {
return func(opts ClientOptions) {
.....
}
}
```

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.