当前位置:网站首页>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
边栏推荐
- EGO Planner代码解析bspline_optimizer部分(2)
- Torch learning notes (7) -- take lenet as an example for dataload operation (detailed explanation + reserve knowledge supplement)
- Find the median of two positive arrays
- 我們做了一個智能零售結算平臺
- 042. (2.11) do it when it's time to do it
- my. INI file not found
- High concurrency Architecture - distributed search engine (ES)
- EGO Planner代码解析bspline_optimizer部分(3)
- High concurrency Architecture - separate databases and tables
- After nohup NPM start &, close the shell window directly, and the process closes accordingly
猜你喜欢
![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]

ActiveMQ的基础

Transformer T5 model read slowly

What does a really excellent CTO look like in my eyes

KINGS

Read the paper glodyne global topology preserving dynamic network embedding

22.2.14 -- station B login with code -for circular list form - 'no attribute' - 'needs to be in path selenium screenshot deviation -crop clipping error -bytesio(), etc

【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁

leetcode:11. 盛最多水的容器【双指针 + 贪心 + 去除最短板】

Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification
随机推荐
Processing of user input parameters in shell script
【光学】基于matlab介电常数计算【含Matlab源码 1926期】
Add control at the top of compose lazycolumn
Multifunctional web file manager filestash
变化是永恒的主题
math_泰勒公式
Record: pymysql is used in pycharm to connect to the database
Which do MySQL and Oracle learn?
How to disable the clear button of ie10 insert text box- How can I disable the clear button that IE10 inserts into textboxes?
Sqlalchemy - subquery in a where clause - Sqlalchemy - subquery in a where clause
Understanding of database architecture
Scrape crawler framework
“google is not defined” when using Google Maps V3 in Firefox remotely
Web3 credential network project galaxy is better than nym?
leetcode:11. Container with the most water [double pointer + greed + remove the shortest board]
The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
Shell script return value with which output
The installation path cannot be selected when installing MySQL 8.0.23
达梦数据库的物理备份和还原简解
Record: MySQL changes the time zone