streamnative / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
1 stars 2 forks source link

ISSUE-443: Add context param in interceptor #140

Open sijie opened 3 years ago

sijie commented 3 years ago

Original Issue: apache/pulsar-client-go#443


Is your feature request related to a problem? Please describe. I want to add opentracing tracking for message delivery. Executing opentracing related code in the interceptor is an elegant way which won't cause a bad influence on my logic code. However, the interceptor has no context parameter, which makes it difficult to pass in the relevant context.

Describe the solution you'd like I want to add context param in ProducerInterceptor's BeforeSend method. BeforeSend(producer Producer, message ProducerMessage) ↓ BeforeSend(ctx context.Context, producer Producer, message ProducerMessage)

GPrabhudas commented 3 years ago

As the issue points out, Is it possible to add context.Context as parameter to BeforeSend method ?

I've requirement to add some common properties to the message before sending it. So I think BeforeSend method is a good place to do this if it accepts context.Context parameter.