mq:移除默认的 spring cloud stream 和 bus,使用原生的 spring-rocketmq、spring-kafka、spring-rabbitmq 替代,降低学习成本,提升使用灵活性。
parent
02693836b2
commit
2450d7afdc
@ -1,41 +0,0 @@
|
||||
package cn.iocoder.yudao.framework.mq.core.bus;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.bus.ServiceMatcher;
|
||||
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 基于 Spring Cloud Bus 实现的 Producer 抽象类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public abstract class AbstractBusProducer {
|
||||
|
||||
@Resource
|
||||
protected ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@Resource
|
||||
protected ServiceMatcher serviceMatcher;
|
||||
|
||||
@Value("${spring.application.name}")
|
||||
protected String applicationName;
|
||||
|
||||
protected void publishEvent(RemoteApplicationEvent event) {
|
||||
applicationEventPublisher.publishEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 只广播给自己服务的实例
|
||||
*/
|
||||
protected String selfDestinationService() {
|
||||
return applicationName + ":**";
|
||||
}
|
||||
|
||||
protected String getBusId() {
|
||||
return serviceMatcher.getBusId();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue