当前位置:网站首页>Foundation of ActiveMQ
Foundation of ActiveMQ
2022-07-03 19:01:00 【LAN Jiao Yu wenle】
One 、 install
Portal :ActiveMQ
And JDK Corresponding version , Otherwise, an error will be reported

ActiveMQ The correct startup of requires installation jdk
jdk Installation documentation for :
linux install jdk8_ Last d Light language blog -CSDN Blog _linux install jdk
Unpack the command :tar -zxvf apache-activemq-5.16.5-bin.tar.gz
Get into bin Catalog : cd apache-activemq-5.16.5/bin/
start-up ActiveMQ : ./activemq startLaunch success screen :

activemq The default port number is :61616 , The port number for external access is :ip:8161/admin/
account number :admin
password :admin
cannot access activemq Console solution :
Attention to detail : Need to restart activemq
Click on Queues You can view the message queue

Two 、SpringBoot Integrate ActiveMQ test
① Import dependence , The downloaded version will be introduced into that version
<!-- activemq rely on -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
② The configuration file
server:
port: 8001
spring:
application:
name: activemq
activemq:
broker-url: tcp://xxx.xxx.xxx.xxx:61616
user: admin
password: admin
jms:
pub-sub-domain: false # Configure whether it is in publish subscribe mode , Default false For point-to-point mode ③ Point to point mode
Generator message sending :


Consumer message acceptance :
// Inject IOC Containers
@Component
public class ActivemqListener {
// Set up queue Destination , Same as the previously configured destinationName bring into correspondence with
@JmsListener(destination = "test-queue")
public void receiveMsg(Message message) throws JMSException {
// Because the message we send is of string type , So here we judge and filter the types
if(message instanceof TextMessage){
// Forced to TextMessage
TextMessage textMessage = (TextMessage) message;
System.out.println(textMessage.getText());
}
}
}Last , Start the startup class , That is, you can send it point-to-point , Receive messages sent by producers !

④ Publish subscribe
Modify the configuration

producer

consumer

Because this is a release - A subscription model , So we must first run consumers , After the consumer successfully starts , Restart producer
边栏推荐
- High concurrency Architecture - distributed search engine (ES)
- Ping problem between virtual machine and development board
- Compose LazyColumn 顶部添加控件
- Boost. Asio Library
- After nohup NPM start &, close the shell window directly, and the process closes accordingly
- EGO Planner代码解析bspline_optimizer部分(3)
- Smart wax therapy machine based on STM32 and smart cloud
- flask 生成swagger文档
- 【LeetCode】【SQL】刷题笔记
- 平淡的生活里除了有扎破皮肤的刺,还有那些原本让你魂牵梦绕的诗与远方
猜你喜欢

KINGS
![235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]](/img/f5/f2d244e7f19e9ddeebf070a1d06dce.png)
235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]

Dart JSON编码器和解码器剖析

Ctrip will implement a 3+2 work system in March, with 3 days on duty and 2 days at home every week

记录在模拟器中运行flutter时报的错

Nous avons fait une plateforme intelligente de règlement de détail

Su embedded training - Day10

EGO Planner代码解析bspline_optimizer部分(3)

PyTorch中在反向传播前为什么要手动将梯度清零?

Add control at the top of compose lazycolumn
随机推荐
CV in transformer learning notes (continuously updated)
Record: solve the problem that MySQL is not an internal or external command environment variable
Web3 credential network project galaxy is better than nym?
Suffix derivation based on query object fields
Unity2018 to wechat games without pictures
EGO Planner代码解析bspline_optimizer部分(2)
Record: writing MySQL commands
leetcode:556. 下一个更大元素 III【模拟 + 尽可能少变更】
Caddy server agent
Help change the socket position of PCB part
【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】
Multifunctional web file manager filestash
变化是永恒的主题
How can I avoid "div/0!" Errors in Google Docs spreadsheet- How do I avoid the '#DIV/0!' error in Google docs spreadsheet?
HOW TO WRITE A DAILY LAB NOTE?
Raft 日志复制
Integrated easy to pay secondary domain name distribution system
Record: MySQL changes the time zone
我们做了一个智能零售结算平台
What does foo mean in programming?