当前位置:网站首页>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 start
Launch 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
边栏推荐
- 达梦数据库的物理备份和还原简解
- my. INI file not found
- TypeScript 官网教程
- Flutter network and data storage framework construction-b1
- 组策略中开机脚本与登录脚本所使用的用户身份
- High concurrency Architecture - separate databases and tables
- How can I avoid "div/0!" Errors in Google Docs spreadsheet- How do I avoid the '#DIV/0!' error in Google docs spreadsheet?
- Record: MySQL changes the time zone
- 【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁
- 我们做了一个智能零售结算平台
猜你喜欢
Read the paper glodyne global topology preserving dynamic network embedding
Add control at the top of compose lazycolumn
Transformer T5 model read slowly
Flutter network and data storage framework construction-b1
Record: solve the problem that MySQL is not an internal or external command environment variable
235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
Integrated easy to pay secondary domain name distribution system
leetcode:11. Container with the most water [double pointer + greed + remove the shortest board]
Recommend a simple browser tab
my. INI file not found
随机推荐
High concurrency Architecture - separate databases and tables
Software development freelancer's Road
虚拟机和开发板互Ping问题
235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]
SQL custom collation
Transformer T5 model read slowly
High concurrency architecture cache
[Yu Yue education] theoretical mechanics reference materials of Shanghai Jiaotong University
Sustainable service business models
235. The nearest common ancestor of the binary search tree [LCA template + same search path]
Torch learning notes (5) -- autograd
Simple solution of physical backup and restore of Damon database
Compose LazyColumn 顶部添加控件
【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁
Boost.Asio Library
Sqlalchemy - subquery in a where clause - Sqlalchemy - subquery in a where clause
Zhengda futures news: soaring oil prices may continue to push up global inflation
Simulation scheduling problem of SystemVerilog (1)
php-fpm的max_chindren的一些误区
JS_ Array_ sort