|
|
@@ -4,11 +4,12 @@ package cn.tr.plugin.eventbus;
|
|
|
import cn.tr.plugin.eventbus.config.EventBus;
|
|
|
import cn.tr.plugin.eventbus.config.StdEventBus;
|
|
|
import cn.tr.plugin.eventbus.config.SubscribeListenerAnnotationBeanPostProcessor;
|
|
|
-import cn.tr.plugin.eventbus.mq.consumer.EvenBusConsumer;
|
|
|
+import cn.tr.plugin.eventbus.mq.consumer.EventBusConsumer;
|
|
|
+import cn.tr.plugin.eventbus.mq.consumer.ExEventBusConsumer;
|
|
|
import cn.tr.plugin.eventbus.mq.message.EvenBusMessageEvent;
|
|
|
import cn.tr.plugin.eventbus.mq.producer.EvenBusProducer;
|
|
|
+import cn.tr.plugin.eventbus.mq.producer.ExEventBusProducer;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
|
|
import org.springframework.cloud.bus.ServiceMatcher;
|
|
|
import org.springframework.cloud.bus.jackson.RemoteApplicationEventScan;
|
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
|
@@ -21,26 +22,36 @@ import org.springframework.context.annotation.Bean;
|
|
|
* @Date: 2023年03月15日
|
|
|
*/
|
|
|
@RemoteApplicationEventScan(basePackageClasses = EvenBusMessageEvent.class)
|
|
|
-@AutoConfigureAfter({ApplicationEventPublisher.class,ServiceMatcher.class})
|
|
|
public class TrEventBusAutoConfiguration {
|
|
|
|
|
|
+ @Bean
|
|
|
+ public ExEventBusConsumer exEventBusConsumer(){
|
|
|
+ return new ExEventBusConsumer();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public ExEventBusProducer exEventBusProducer(){
|
|
|
+ return new ExEventBusProducer();
|
|
|
+ }
|
|
|
+
|
|
|
@Value("${spring.application.name}")
|
|
|
protected String applicationName;
|
|
|
|
|
|
@Bean
|
|
|
- public EvenBusConsumer evenBusConsumer(){
|
|
|
- return new EvenBusConsumer();
|
|
|
+ public EventBusConsumer eventBusConsumer(){
|
|
|
+ return new EventBusConsumer();
|
|
|
}
|
|
|
|
|
|
@Bean
|
|
|
- public EvenBusProducer evenBusProducer( ApplicationEventPublisher applicationEventPublisher,ServiceMatcher serviceMatcher){
|
|
|
+ public EvenBusProducer eventBusProducer( ApplicationEventPublisher applicationEventPublisher,ServiceMatcher serviceMatcher){
|
|
|
return new EvenBusProducer(applicationEventPublisher,serviceMatcher,applicationName);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Bean
|
|
|
- public EventBus eventBus(EvenBusConsumer evenBusConsumer, EvenBusProducer evenBusProducer){
|
|
|
- return new StdEventBus(evenBusConsumer,evenBusProducer);
|
|
|
+ public EventBus eventBus(EventBusConsumer eventBusConsumer, EvenBusProducer evenBusProducer,
|
|
|
+ ExEventBusConsumer excludeConsumer, ExEventBusProducer excludeProducer){
|
|
|
+ return new StdEventBus(eventBusConsumer,evenBusProducer,excludeProducer,excludeConsumer);
|
|
|
}
|
|
|
|
|
|
@Bean
|