wenfengwang commented on a change in pull request #85: [ISSUE #86] Add 
Interceptor for producer and consumer.
URL: https://github.com/apache/rocketmq-client-go/pull/85#discussion_r300817657
 
 

 ##########
 File path: internal/consumer/push_consumer.go
 ##########
 @@ -99,9 +104,37 @@ func NewPushConsumer(consumerGroup string, opt 
primitive.ConsumerOption) (PushCo
        } else {
                p.submitToConsume = p.consumeMessageCurrently
        }
+
+       ChainInterceptor(p)
+
        return p, nil
 }
 
+// ChainInterceptor chain list of interceptor as one interceptor
+func ChainInterceptor(p *pushConsumer) {
+       interceptors := p.option.Interceptors
+       switch len(interceptors) {
+       case 0:
+               p.interceptor = nil
+       case 1:
+               p.interceptor = interceptors[0]
+       default:
+               p.interceptor = func(ctx context.Context, req, reply 
interface{}, invoker primitive.CInvoker) error {
 
 Review comment:
   ok

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to