安装

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中的使用的更多相关文章

  1. activemq安装运行及其在springboot中的queue和topic使用

    安装activemq 运行 springboot使用 依赖 配置 Producer Consumer ComsumerTopic 使用 安装activemq http://activemq.apach ...

  2. ActiveMQ 的安装与使用(springboot版本)

    一.安装 上官网下载tar包 http://activemq.apache.org/ tar -zxvf 后进入bin/linux-86-64 ./activimq start 启动 二.使用 pom ...

  3. 以ActiveMQ为例JAVA消息中间件学习【3】——SpringBoot中使用ActiveMQ

    前言 首先我们在java环境中使用了ActiveMQ,然后我们又在Spring中使用了ActiveMQ 本来这样已经可以了,但是最近SpringBoot也来了.所以在其中也需要使用试试. 可以提前透露 ...

  4. (二)Redis在Mac下的安装与SpringBoot中的配置

    1 下载Redis 官网下载,下载 stable 版本,稳定版本. 2 本地安装 解压:tar zxvf redis-6.0.1.tar.gz 移动到: sudo mv redis-6.0.1 /us ...

  5. Android中插件开发篇之----动态加载Activity(免安装运行程序)

    一.前言 又到周末了,时间过的很快,今天我们来看一下Android中插件开发篇的最后一篇文章的内容:动态加载Activity(免安装运行程序),在上一篇文章中说道了,如何动态加载资源(应用换肤原理解析 ...

  6. [转+补]Android打包so后魅族5中安装运行崩溃问题的解决方法

    上周在做噪音检测so集成中,遇到不同的so库打包到 APK 时,安装在某些机器上,出现 java.lang.UnsatisfiedLinkError 加载失败. 为此,深究了一下原理,和给出了解决方案 ...

  7. SpringBoot(四)SpringBoot中lombok使用

    lombok概述 lombok简介 Lombok想要解决了的是在我们实体Bean中大量的Getter/Setter方法,以及toString, hashCode等可能不会用到,但是某些时候仍然需要复写 ...

  8. springBoot中使用定时任务

    简单示例 导入依赖 springBoot已经默认集成了定时任务的依赖,只需要引入基本的依赖就可以使用定时任务. <parent> <groupId>org.springfram ...

  9. ActiveMQ 的安装与使用

    消息中间件简介 消息中间件(MOM:Message Orient middleware) 消息中间件有很多的用途和优点: 1. 将数据从一个应用程序传送到另一个应用程序,或者从软件的一个模块传送到另外 ...

随机推荐

  1. iOS自动化探索(五)自动化测试框架pytest - Assert断言的使用

    使用assert语句进行断言 pytest允许使用标准的python assert语法,用来校验expectation and value是否一致 代码演示: def func(): def test ...

  2. 【nyoj-1274】信道安全(SPFA)

    题目链接:http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=1274 题目描述 Alpha 机构有自己的一套网络系统进行信息传送.情报员 A 位于 ...

  3. struts中操作request,session

    在Action类中操作request,session 方法一.利用ActionContext.getContext().get("request"); //返回的是Map集合 Ma ...

  4. LeetCode OJ :Unique Binary Search Trees II(唯一二叉搜索树)

    题目如下所示:返回的结果是一个Node的Vector: Given n, generate all structurally unique BST's (binary search trees) th ...

  5. Android数据库代码优化(1) - 从Google的数据库guide说起

    假如我们没有任何在Android上使用SQLite的经验,现在要开始在工作中用SQLite存储一些数据.OK, 我们去看google的官方培训文档吧,http://developer.android. ...

  6. 正则化项L1和L2的区别

    https://blog.csdn.net/jinping_shi/article/details/52433975 https://blog.csdn.net/zouxy09/article/det ...

  7. Codeforces 589F Gourmet and Banquet

    A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet kno ...

  8. [BZOJ5297][CQOI2018]社交网络

    bzoj luogu sol 就是求以\(1\)为根的生成树的数量. 直接矩阵树定理. code #include<cstdio> #include<algorithm> #i ...

  9. CSS书写格式

    转自: https://segmentfault.com/a/1190000005046830 CSS书写格式 1.格式化代码 1.1文件 [建议]:CSS文件使用无BOM的UTF-8编码 1.2缩进 ...

  10. 洛谷 P2205 [USACO13JAN]画栅栏Painting the Fence

    传送门 题目大意: 开始站在原点,给出一系列操作 x L/R,表示向左或向右走几步. 最多会移动到离原点1,000,000,000单位远的地方. n次操作,n<=100000 问走过k次的地方有 ...