资源简介
Spring和ActiveMQ整合的完整实例
代码片段和文件信息
package com.tgb.SpringActivemq.controller;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tgb.SpringActivemq.mq.producer.queue.QueueSender;
import com.tgb.SpringActivemq.mq.producer.topic.TopicSender;
/**
*
* @author liang
* @description controller测试
*/
@Controller
@RequestMapping(“/activemq“)
public class ActivemqController {
@Resource
QueueSender queueSender;
@Resource
TopicSender topicSender;
/**
* 发送消息到队列
* Queue队列:仅有一个订阅者会收到消息,消息一旦被处理就不会存在队列中
* @param message
* @return String
*/
@ResponseBody
@RequestMapping(“queueSender“)
public String queueSender(@RequestParam(“message“)String message){
String opt=““;
try {
queueSender.send(“test.queue“ message);
opt = “suc“;
} catch (Exception e) {
opt = e.getCause().toString();
}
return opt;
}
/**
* 发送消息到主题
* Topic主题 :放入一个消息,所有订阅者都会收到
* 这个是主题目的地是一对多的
* @param message
* @return String
*/
@ResponseBody
@RequestMapping(“topicSender“)
public String topicSender(@RequestParam(“message“)String message){
String opt = ““;
try {
topicSender.send(“test.topic“ message);
opt = “suc“;
} catch (Exception e) {
opt = e.getCause().toString();
}
return opt;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-06-19 11:26 ActiveMQSpringDemo\
文件 2581 2017-06-19 11:26 ActiveMQSpringDemo\.classpath
文件 1227 2017-06-19 11:26 ActiveMQSpringDemo\.project
目录 0 2017-06-19 11:26 ActiveMQSpringDemo\.settings\
文件 503 2015-09-24 21:39 ActiveMQSpringDemo\.settings\.jsdtscope
文件 430 2017-06-19 11:26 ActiveMQSpringDemo\.settings\org.eclipse.jdt.core.prefs
文件 90 2017-06-19 11:26 ActiveMQSpringDemo\.settings\org.eclipse.m2e.core.prefs
文件 590 2017-06-19 11:26 ActiveMQSpringDemo\.settings\org.eclipse.wst.common.component
文件 345 2015-09-24 21:39 ActiveMQSpringDemo\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2015-09-24 21:39 ActiveMQSpringDemo\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2015-09-24 21:39 ActiveMQSpringDemo\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 50 2017-06-19 11:26 ActiveMQSpringDemo\.settings\org.eclipse.wst.validation.prefs
目录 0 2015-09-24 21:39 ActiveMQSpringDemo\build\
目录 0 2015-09-26 14:50 ActiveMQSpringDemo\build\classes\
文件 3454 2015-09-26 14:50 ActiveMQSpringDemo\build\classes\ActiveMQ.xm
文件 1599 2015-09-24 23:28 ActiveMQSpringDemo\build\classes\applicationContext.xm
目录 0 2015-09-25 15:47 ActiveMQSpringDemo\build\classes\com\
目录 0 2015-09-25 15:47 ActiveMQSpringDemo\build\classes\com\tgb\
目录 0 2015-09-25 15:47 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\
目录 0 2015-09-26 13:06 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\controller\
文件 1847 2015-09-26 12:56 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\controller\ActivemqController.class
目录 0 2015-09-25 15:47 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\
目录 0 2015-09-25 15:47 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\consumer\
目录 0 2015-09-26 11:15 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\consumer\queue\
文件 1151 2015-09-26 11:15 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\consumer\queue\QueueReceiver1.class
文件 1151 2015-09-25 15:48 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\consumer\queue\QueueReceiver2.class
目录 0 2015-09-26 11:16 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\consumer\topic\
文件 1151 2015-09-26 11:16 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\consumer\topic\TopicReceiver1.class
文件 1151 2015-09-25 15:48 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\consumer\topic\TopicReceiver2.class
目录 0 2015-09-25 15:47 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\producer\
目录 0 2015-09-25 15:48 ActiveMQSpringDemo\build\classes\com\tgb\SpringActivemq\mq\producer\queue\
............此处省略91个文件信息
相关资源
- 用VS2008编译好的activemq-cpp3.8.3库,含源
- SpringBoot整合ActiveMQ消息队列和双向队
- activemq的安装
- apache-activemq-5.13.1-bin.tar.gz
- apache-activemq-5.13.0-bin.tar.gz
- activemqC开发
- springboot-tio-activemq.rar整合SpringBoot实现
- SpringBoot使用JMS的小ActiveMQ实现
- activeMQ从入门到精通视频教程
- activemq 入门
- ActiveMQ中文文档.pdf
- qt activemq mqtt 动态库
- SpringBoot整合ActiveMQ(消息中间件)实
- MSMQ、RabbitMQ、ActiveMQ消息队列调试工具
- SpringBoot+ActiveMq+MQTT实现消息的发送和
- 消息中间件项目
- SpringActiveMQ
- activemqdubbolinuxredisshirosolr笔记整合,基
评论
共有 条评论