Apache rocketmq

Clone this repo:
  1. 477d478 Merge pull request #258 from lizhanhui/share_netty_event_loop by Zhanhui Li · 3 weeks ago main
  2. be643e4 feat: use shared netty event loop for TCP/TCP over TLS/Web Socket by Li Zhanhui · 3 weeks ago
  3. eee7527 Merge pull request #259 from lizhanhui/websocket_over_tls by Zhanhui Li · 3 weeks ago
  4. b169c14 feat: support WebSocket over TLS transport by Li Zhanhui · 3 weeks ago
  5. 83ac404 Merge pull request #257 from apache/keep_alive by Zhanhui Li · 5 weeks ago

Apache RocketMQ MQTT

Build Status License CodeCov Average time to resolve an issue Percentage of issues still open Twitter Follow

A new MQTT protocol architecture model, based on which RocketMQ can better support messages from terminals such as IoT devices and Mobile APP. Based on the RocketMQ message unified storage engine, it supports both MQTT terminal and server message sending and receiving.The entire project design refer to MQTT overview.


The relevant architecture design is introduced in RIP-33. The queue model of MQTT needs to be based on the light message queue, For the design of the specific light message queue, please refer to the RIP-28(LMQ)-wiki of RocketMQ.

Get Started


The queue model of MQTT needs to be based on the light message queue feature (RIP-28) of RocketMQ. RocketMQ has only supported this feature since version 4.9.3. Please ensure that the installed version of RocketMQ already supports this feature.

For the quick start of light message queue, please refer to Example_LMQ of RocketMQ. For example, set the following parameters to true in broker.conf

enableLmq = true
enableMultiDispatch = true

Build Requirements

The current project requires JDK 1.8.x. When building on MAC arm64 the recommended JDK 1.8 must be based on 386 architecture or use Maven flag -Dos.arch=x86_64 when building with Maven.

  1. Clone
git clone https://github.com/apache/rocketmq-mqtt
  1. Build the package
cd rocketmq-mqtt
mvn -Prelease-all -DskipTests clean install -U 
  1. Config
cd distribution/target/
cd conf

Some important configuration items in the service.conf configuration file

Config KeyInstruction
usernameused for auth
secretKeyused for auth
NAMESRV_ADDRspecify namesrv address
eventNotifyRetryTopicnotify event retry topic
clientRetryTopicclient retry topic
metaAddrmeta all nodes ip:port. Same as membersAddress in meta.config

And some configuration items in the meta.conf configuration file

Config KeyInstruction
selfAddressmeta cur node ip:port, e.g.
membersAddressmeta all nodes ip:port, e.g.,,
  1. CreateTopic

    create all first-level topics, including eventNotifyRetryTopic and clientRetryTopic in the configuration file above.

sh mqadmin updatetopic -c {cluster} -t {topic} -n {namesrv}
  1. Initialize Meta
  • Configure Gateway Node List
sh mqadmin updateKvConfig -s LMQ -k LMQ_CONNECT_NODES -v {ip1,ip2} -n {namesrv}
  • Configure the first-level topic list
sh mqadmin updateKvConfig -s LMQ -k ALL_FIRST_TOPICS -v {topic1,topic2} -n {namesrv}
  • Configure a list of wildcard characters under each first-level topic
sh mqadmin updateKvConfig  -s LMQ -k {topic} -v {topic/+}  -n {namesrv}
  1. Start Process
cd bin
sh meta.sh start
sh mqtt.sh start


The mqtt-example module has written basic usage example code, which can be used for reference

Protocol Version

The currently supported protocol version is MQTT 3.1.1.


At present, an implementation based on the HmacSHA1 signature algorithm is provided by default, Refer to AuthManagerSample. Users can customize other implementations to meet the needs of businesses to flexibly verify resources and identities.

Meta Persistence

At present, meta data storage and management is simply implemented through the kvconfig mechanism of namesrv by default, Refer to MetaPersistManagerSample. Users can customize other implementations.


Apache License, Version 2.0 Copyright (C) Apache Software Foundation.