百度网站建设微信封面,紫鸟超级浏览器一个月多少钱,广州方舱医院最新消息,单位做网站文章目录 maven依赖引入监听器注入和发送消息接收消息属性配置 项目用到rqueue#xff0c;虽然知道和redis相关#xff0c;但是肯定有不一样的地方#xff0c;做个笔记。 maven依赖
网上找个能用的版本就行#xff0c;如#xff1a;
dependencygroupIdc… 文章目录 maven依赖引入监听器注入和发送消息接收消息属性配置 项目用到rqueue虽然知道和redis相关但是肯定有不一样的地方做个笔记。 maven依赖
网上找个能用的版本就行如
dependencygroupIdcom.github.sonus21/groupIdartifactIdrqueue-spring-boot-starter/artifactIdversion2.13.2-RELEASE/version
/dependency引入监听器
属于配置类可以考虑和StartupApplication同目录。
Component
public class MessageSender implements ApplicationListenerRqueueBootstrapEvent {Autowiredprivate RqueueEndpointManager rqueueEndpointManager;Overridepublic void onApplicationEvent(RqueueBootstrapEvent event) {if (!event.isStartup()) {return;}String[] a new String[]{ARCHIVES-CHECK-QUEUE,ARCHIVES-CONVERSION-QUEUE};for (String queue : a) {String[] priorities getPriority(queue);if (!rqueueEndpointManager.isQueueRegistered(queue)) {rqueueEndpointManager.registerQueue(queue, priorities);}}}private String[] getPriority(String queue) {
// return new String[]{high, medium, low};return new String[]{};}
}
注入和发送消息 接收消息
属性配置