In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
First, brief introduction
ActiveMQ is an excellent JMS implementation framework, which has the advantages of simple, convenient and good performance in asynchronous message communication.
Second, installation
Download address: http://mirror.bit.edu.cn/apache/activemq/
Just decompress it.
Three, start
Windows start
Linux start
Fourth, java application
Dependent package: activemq-all-5.12.0.jar
Send a message:
/ / construct the ConnectionFactory instance object, here using the implementation of ActiveMq jarConnectionFactory connectionFactory = new ActiveMQConnectionFactory (ActiveMQConnection.DEFAULT_USER,ActiveMQConnection.DEFAULT_PASSWORD, "tcp://localhost:61616"); / / construct the connection object Connection connection = connectionFactory.createConnection () from the factory; / / start connection.start (); / / get the operation connection Session session = connection.createSession (Boolean.TRUE,Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue ("FirstQueue") / / get the message generator [sender] MessageProducer producer = session.createProducer (destination); / / set non-persistence. Learn here and actually decide producer.setDeliveryMode (DeliveryMode.NON_PERSISTENT) according to the project.
To this producer object generation, the next step is to send data
/ / create message TextMessage message = session.createTextMessage ("message sent by ActiveMq"); / / send producer.send (message)
Consumers accept data
Create a connection as above
`/ / message consumer object
MessageConsumer consumer = session.createConsumer (destination)
/ / receive messages
TextMessage message = (TextMessage) consumer.receive (100000)
`
Fifth, message management
Built-in management: http://127.0.0.1:8161/admin/
Username password: default username password admin,admin
Set up
The main menus on the management page are: 1 ActiveMq home: current ActiveMq information, name, id, version, etc. 2 focus queues: queues running in the current message, as well as the number of producers, consumers, and queuing messages in the queue, etc.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.