apache / apache/pulsar-client-go
[all] support contexts
- 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.**
The library does not take a context/context.
**Describe the solution you'd like**
I expect clients and producers to take a context argument upon creation and have all goroutines created by the clients and producers take a context as well. This is important for tracing (see https://medium.com/swlh/distributed-tracing-for-go-microservice-with-opentracing-1fc1aec76b3e). The context needs to be piped into all goroutines for observability.
It's also important to select on `ctx.Done()` when sending or recieving to channels. The libary does not do that at the moment. Ex.
What if the command chan is full and `cp` cannot be send? This method will block. It would be beneficial to also select on a context provided by the user of the library in case the caller wants to cancel long running blocked operations.
https://github.com/apache/pulsar-client-go/blob/f476814a9e1bac484e9589d4fb3f299066f54ddc/pulsar/producer_partition.go#L1462-L1473
Contributor guide
Research direction
Start with the referenced pulsar/producer_partition.go section, then map how clients and producers create goroutines and send or receive on channels. Determine the scope of context propagation and cancellation across those paths; done means the requested contexts reach created goroutines and blocked channel operations can respond to cancellation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100