spring boot整合activemq rabbitmq
来源:互联网 发布:vlookup匹配多列数据 编辑:程序博客网 时间:2024/05/21 17:22
1.下载并安装activemq服务(windows),下载地址:http://download.csdn.net/download/loveuserzzz/9938202
2.创建springboot工程,并引入依赖
<dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-all</artifactId> <version>5.15.0</version></dependency>
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-activemq</artifactId></dependency>3.编写生产者代码实现
@Componentpublic class Producer implements CommandLineRunner{ @Autowired private JmsMessagingTemplate jmsMessagingTemplate; @Autowired private Queue queue; @Override public void run(String... args) throws Exception { send("Sample message"); System.out.println("Message was sent to the Queue"); } public void send(String msg) { this.jmsMessagingTemplate.convertAndSend(this.queue, msg); }}4.编写客户端实现
@Componentpublic class Consumer { @JmsListener(destination = "sample.queue") public void receiveQueue(String text) { System.out.println(text); }}5.编写application.properties
spring.activemq.in-memory=truespring.activemq.pool.enabled=false6.启动activemq服务
7.启动main运行查看结果
下载源码:https://github.com/yifanzzz/springboot-mq.git
示例中包含activemq和rabbitmq两部分,可以加群一起讨论QQ:324070788
阅读全文
0 0
- spring boot整合activemq rabbitmq
- spring boot整合activemq
- Spring Boot整合RabbitMQ
- (八)Spring Boot整合ActiveMQ
- Spring Boot与ActiveMQ整合
- spring boot整合rabbitmq踩坑
- Spring Boot整合RabbitMQ实例
- spring boot整合JMS(ActiveMQ实现)
- spring boot整合JMS(ActiveMQ实现)
- Spring Boot 整合ActiveMQ的过程
- spring boot实战(第十二篇)整合RabbitMQ
- spring boot实战(第十二篇)整合RabbitMQ
- spring boot实战(第十二篇)整合RabbitMQ
- spring boot整合RabbitMQ(Direct模式)
- spring boot整合RabbitMQ(Direct模式)
- spring boot整合RabbitMQ(Topic模式)
- spring boot整合RabbitMQ(Fanout模式)
- spring boot实战(番外篇)整合RabbitMQ
- 服务器部署
- ps与pstree命令
- 身份证信息中间变星
- 设计模式解密(21)- 解释器模式
- 51Nod1018 排序(C语言)
- spring boot整合activemq rabbitmq
- 接受一个正浮点数值,输出该数值的近似整数值。如果小数点后数值大于等于5,向上取整;小于5,则向下取整
- HDU 1034 Candy Sharing Game(水题)
- ListView第一次加载的时候自动滚动到底部,滑动的时候新增数据时不会跳转至底部
- spiral-matrix I&II
- jsp页面增加天气和时间的显示
- Linux功耗管理(13)_Driver的电源管理
- JavaWeb项目中classpath详解
- UNITY中常用矩阵