ActiveMQ Notes

安装

Docker run

1
docker run -d --name activemq -p 61616:61616 -p 61613:61613 -p 61614:61614 -p 5672:5672 -p 1883:1883 -p 8161:8161 rmohr/activemq:5.15.9

环境变量

  • ACTIVEMQ_TCP=61616
  • ACTIVEMQ_AMQP=5672
  • ACTIVEMQ_STOMP=61613
  • ACTIVEMQ_MQTT=1883
  • ACTIVEMQ_WS=61614
  • ACTIVEMQ_UI=8161

UI

1
http://localhost:8161/admin

用户/密码: admin/admin

Protocols

MQTT 消息队列遥测传输

Message Queuing Telemetry Transport

MQTT Publish / Subscribe Architecture

mqtt-publish-subscribe

MQTT Specification

客户端

  • Eclipse Paho
1
2
3
4
5
6
7
8
// eclipse paho
https://www.eclipse.org/paho/index.php?page=clients/java/index.php#

// github
https://github.com/eclipse/paho.mqtt.java

// javadoc
https://www.eclipse.org/paho/files/javadoc/index.html

JMS Java消息服务

Java Message Service

JMS Specification

https://www.oracle.com/java/technologies/java-message-service.html

AMQP 高级消息队列协议

Advanced Message Queuing Protocol

AMQP Specification

https://www.amqp.org/

https://activemq.apache.org/amqp

STOMP 简单(或流)面向文本的消息传递协议

STOMP is the Simple (or Streaming) Text Orientated Messaging Protocol.

Stomp Specification

客户端

ActiveMQ Library:

1
2
3
4
5
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.15.0</version>
</dependency>

Package:

1
2
import org.apache.activemq.transport.stomp.StompConnection;
import org.apache.activemq.transport.stomp.StompFrame;

Examples

Java Client Demo

https://github.com/shankai/artifacts/tree/master/activemq-example