rabbitmq-intercepter是通过javassist字节码注入的方式实现的RMQ拦截器,支持producer和consumer的拦截,同时开放SPI扩展.
- Gradle
- Java 8
gradle clean build -x test
dependencies {
compile 'com.infi:rabbitmq-intercepter:0.0.1-SNAPSHOT'
}
- 程序入口初始化
@SpringBootApplication
public class TestApplication {
static {
// 需要加在RMQ class类之前初始化,建议在程序入口
RmqIntercepterInitializer.getInstance().init();
}
public static void main(String[] args) throws Exception {
SpringApplication application = new SpringApplication(TestApplication.class);
application.run(args);
}
}
- SPI扩展
//Producer拦截SPI接口
com.infi.rabbitmq.intercepter.spi.RmqProducerIntercepter
//Consumer拦截SPI接口
com.infi.rabbitmq.intercepter.spi.RmqConsumerIntercepter
// 具体参照testcase