apache / apache/pulsar-client-go

Add a Context for `pulsar.Message` interface

Open
#803 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
745
Forks
389
Avg merge
3d 20h
Merged PRs (30d)
3

Description

Receive method of Consumer returns Message directly, but if we want attach something(ex SpanContext) in Receive method to context, we can't bring it out without change type of Message interface.

So, it is possible to add a Context or find some other way to set a context for Message ?

```go
type Consumer interface {
Receive(context.Context) (Message, error)
...
}

```

Additional, when use SendAsync error handling, we can't get context directly without use Closure.

```go
producer.SendAsync(ctx, &pulsar.ProducerMessage{}, handleErrorFunc)
```

Thank you.

Contributor guide

Open the contributing guide

Research direction

Start by reading the Consumer.Receive and Producer.SendAsync API definitions and the Message interface. Trace how contexts currently enter Receive and SendAsync, then determine the intended context-propagation behavior for received messages and asynchronous error handling. Done requires an agreed API design and corresponding tests for both paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.