activemq artemis安装运行及其在springboot中的使用
安装
http://activemq.apache.org/artemis/download.html
创建broker
将artemis解压完成后,在重新建一个文件夹artmisbroker
运行
artemis.cmd create C:\artmisbroker --user mq --password 123
即可在artmisbroker目录下生成所需的文件
运行artemis
"C:\artmisbroker\bin\artemis" run
使用Windows service方式运行artemis
"C:\artmisbroker\bin\artemis-service.exe" install
"C:\artmisbroker\bin\artemis-service.exe" start
停止 windows service:
"C:\artmisbroker\bin\artemis-service.exe" stop
卸载windows service
"C:\artmisbroker\bin\artemis-service.exe" uninstall
访问 http://localhost:8161/console 进入监视界面
在springboot中的使用
依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-artemis</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
配置
spring.artemis.mode=native
spring.artemis.host=localhost
spring.artemis.port=61616
spring.artemis.user=mq
spring.artemis.password=123
Producer
@Component
public class Producer {
@Autowired
private JmsMessagingTemplate jmsMessagingTemplate;
public void send(Destination destination, final String message) {
jmsMessagingTemplate.convertAndSend(destination, message + "from queue");
}
@JmsListener(destination="out.queue")
public void consumerMessage(String text){
System.out.println("从out.queue队列收到的回复信息为:"+text);
}
}
Consumer
@Component
public class Consumer {
@JmsListener(destination = "mytest.queue")
@SendTo("out.queue")
public String receiveQueue(String text) {
System.out.println("Consumer收到的信息为:"+text);
return "return message "+text;
}
}
Rest使用
@ResponseBody
@RequestMapping(value = "/mqtest", method = RequestMethod.GET)
public Object mqtest() {
Destination destination = new ActiveMQQueue("mytest.queue");
producer.send(destination, "I am YeJiaWei");
return "OK";
}
activemq artemis安装运行及其在springboot中的使用的更多相关文章
- activemq安装运行及其在springboot中的queue和topic使用
安装activemq 运行 springboot使用 依赖 配置 Producer Consumer ComsumerTopic 使用 安装activemq http://activemq.apach ...
- ActiveMQ 的安装与使用(springboot版本)
一.安装 上官网下载tar包 http://activemq.apache.org/ tar -zxvf 后进入bin/linux-86-64 ./activimq start 启动 二.使用 pom ...
- 以ActiveMQ为例JAVA消息中间件学习【3】——SpringBoot中使用ActiveMQ
前言 首先我们在java环境中使用了ActiveMQ,然后我们又在Spring中使用了ActiveMQ 本来这样已经可以了,但是最近SpringBoot也来了.所以在其中也需要使用试试. 可以提前透露 ...
- (二)Redis在Mac下的安装与SpringBoot中的配置
1 下载Redis 官网下载,下载 stable 版本,稳定版本. 2 本地安装 解压:tar zxvf redis-6.0.1.tar.gz 移动到: sudo mv redis-6.0.1 /us ...
- Android中插件开发篇之----动态加载Activity(免安装运行程序)
一.前言 又到周末了,时间过的很快,今天我们来看一下Android中插件开发篇的最后一篇文章的内容:动态加载Activity(免安装运行程序),在上一篇文章中说道了,如何动态加载资源(应用换肤原理解析 ...
- [转+补]Android打包so后魅族5中安装运行崩溃问题的解决方法
上周在做噪音检测so集成中,遇到不同的so库打包到 APK 时,安装在某些机器上,出现 java.lang.UnsatisfiedLinkError 加载失败. 为此,深究了一下原理,和给出了解决方案 ...
- SpringBoot(四)SpringBoot中lombok使用
lombok概述 lombok简介 Lombok想要解决了的是在我们实体Bean中大量的Getter/Setter方法,以及toString, hashCode等可能不会用到,但是某些时候仍然需要复写 ...
- springBoot中使用定时任务
简单示例 导入依赖 springBoot已经默认集成了定时任务的依赖,只需要引入基本的依赖就可以使用定时任务. <parent> <groupId>org.springfram ...
- ActiveMQ 的安装与使用
消息中间件简介 消息中间件(MOM:Message Orient middleware) 消息中间件有很多的用途和优点: 1. 将数据从一个应用程序传送到另一个应用程序,或者从软件的一个模块传送到另外 ...
随机推荐
- Qt WebKit 学习的说明
(转自:http://it.100xuexi.com/view/otdetail/20120827/4021c662-b917-44d9-8284-910cac713c23.html) QT Webk ...
- OC-通知+Block
=================================== 一.通知(NSNotification) NSNotification 通知类,这个类中有 NSNotificationCent ...
- react: typescript-webpack项目基本配置
1.webpack.config.js basic const webpack = require('webpack'); const autoprefixer = require('autopref ...
- L133
The U.S. Food and Drug Administration is considering a ban on flavorede-cigarettes in response to an ...
- Flask 的整体流程
Flask 的整体流程 封装 requestContext 对象, full_dispatch_request(视图函数 执行), response返回 从app.run() 开始 -->> ...
- 程序员们,AI来了,机会来了,危机也来了
程序员们,AI来了,机会来了,危机也来了 1.人工智能真的来了 纵观古今,很少有计算机技术能有较长的发展寿命,大部分昙花一现,比如:昔日的DOS.windows3.2.foxpro.delphi.80 ...
- js 下获取子元素的方法
笔记核心: firstElementChild只会获取元素节点对象,从名称就可以看出来,firstChild则可以获取文本节点对象(当然也可以获取元素节点对象),比如空格和换行都被当做文本节点. js ...
- VSCode安装jshint插件报错
Mac电脑上使用VSCode安装jshint插件时提示如下错误: Failed to load jshint library. Please install jshint in your worksp ...
- ORM版,学生管理系统03
关于老师信息管理 建立多对多关系 第一种(通过外键建立) 自己写类,自己使其建立关系 缺点: 不能用Django ORM 多对多操作的语法 class Teacher(models.Model): t ...
- phpcms v9 tags调用方法
{loop $keywords $keyword} <a href="{APP_PATH}index.php?m=content&c=tag&catid={$catid ...