特征
- ProducerInterceptors实际上是一个包含ProducerInterceptor全路径类名的List,是ProducerInterceptor接口的List集合,实现了Closable接口。其onSend()、onAcknowledgement方法、onSendError方法,实际上是循环调用其封装的ProducerInterceptor集合的对应方法。
- 可以先于CallBack对Ack响应进行预处理,类似Web拦截器
- 可以通过实现ProducerInterceptor接口来自定义拦截器