当前位置:网站首页>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
边栏推荐
- How can I avoid "div/0!" Errors in Google Docs spreadsheet- How do I avoid the '#DIV/0!' error in Google docs spreadsheet?
- Typescript configuration
- [new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
- Help change the socket position of PCB part
- SQL custom collation
- SSH 远程执行命令简介
- FBI警告:有人利用AI换脸冒充他人身份进行远程面试
- Max of PHP FPM_ Some misunderstandings of children
- FBI warning: some people use AI to disguise themselves as others for remote interview
- SSM integration - joint debugging of front and rear protocols (list function, add function, add function status processing, modify function, delete function)
猜你喜欢
A green plug-in that allows you to stay focused, live and work hard
Read the paper glodyne global topology preserving dynamic network embedding
Opencv learning notes (continuously updated)
EGO Planner代码解析bspline_optimizer部分(2)
Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext
Getting started with JDBC
Record: pymysql is used in pycharm to connect to the database
There are several levels of personal income tax
235. The nearest common ancestor of the binary search tree [LCA template + same search path]
Implementation of cqrs architecture mode under Kratos microservice framework
随机推荐
math_泰勒公式
235. The nearest common ancestor of the binary search tree [LCA template + same search path]
【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
Understanding of database architecture
The more you talk, the more your stupidity will be exposed.
【数学建模】基于matlab船舶三自由度MMG模型【含Matlab源码 1925期】
Ping problem between virtual machine and development board
Chisel tutorial - 06 Phased summary: implement an FIR filter (chisel implements 4-bit FIR filter and parameterized FIR filter)
cipher
leetcode:556. Next larger element III [simulation + change as little as possible]
After nohup NPM start &, close the shell window directly, and the process closes accordingly
Web3 credential network project galaxy is better than nym?
__ Weak and__ The difference between blocks
Unity webgl optimization
Differential constrained SPFA
Driveseg: dynamic driving scene segmentation data set
SSH 远程执行命令简介
“google is not defined” when using Google Maps V3 in Firefox remotely
We have built an intelligent retail settlement platform
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线