pulsar-client-go icon indicating copy to clipboard operation
pulsar-client-go copied to clipboard

Add a Context for `pulsar.Message` interface

Open liuhao2050 opened this issue 2 years ago • 0 comments

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 ?

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

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

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

Thank you.

liuhao2050 avatar Jul 06 '22 03:07 liuhao2050