wenfengwang commented on a change in pull request #117: [#ISSUE 104] Support ACL
URL: https://github.com/apache/rocketmq-client-go/pull/117#discussion_r304203002
 
 

 ##########
 File path: internal/remote/remote_client.go
 ##########
 @@ -226,3 +242,29 @@ func (c *RemotingClient) ShutDown() {
                return true
        })
 }
+
+func (c *RemotingClient) RegisterInterceptor(interceptors 
...primitive.Interceptor) {
+       if len(interceptors) == 0 {
+               return
+       }
+       idx := 0
+       if c.interceptor == nil {
+               c.interceptor = interceptors[0]
+               idx = 1
+       }
+       for ; idx < len(interceptors); idx++ {
+               c.interceptor = func(ctx context.Context, req, reply 
interface{}, invoker primitive.Invoker) error {
+                       return interceptors[0](ctx, req, reply, 
getChainedInterceptor(interceptors, idx, invoker))
+               }
+       }
+}
+
+// getChainedInterceptor recursively generate the chained invoker.
+func getChainedInterceptor(interceptors []primitive.Interceptor, cur int, 
finalInvoker primitive.Invoker) primitive.Invoker {
 
 Review comment:
   alpha3统一

----------------------------------------------------------------
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