cserwen opened a new issue #709:
URL: https://github.com/apache/rocketmq-externals/issues/709


   Now RocketMQ has weak support for delayed messages, and only supports 18 
levels of delayed messages. We now have a solution that supports any time 
(second-level precision) delayed messages. Its architecture diagram is as 
follows:
   
   
![延时消息模块架构图【en】](https://user-images.githubusercontent.com/46882838/117393079-e96fc880-af25-11eb-8bee-55cd78e83e00.png)
   
   **Implementation details**
   - This feature is implemented as an extension.
   - Consumers in different nodes belong to a common consumer group. Use Push 
mode to consume delayed messages in delayed topics. In this way, the load 
capacity of `delay expansion` can be horizontally expanded by increasing the 
number of delay group and the queues of delay Topic.
   - In order to ensure the availability of the system, the function of 
automatic master selection is realized based on the Raft protocol. We intend to 
directly use this Dledger 
library(https://github.com/openmessaging/openmessaging-storage-dledger) that 
has implemented the Raft protocol.
   - In order to ensure the consistency between the master and slave nodes, we 
take commitLog as the standard.
   
   **Implementation process**
   1. The producer sends a delay message to the delay Topic in the Broker.
   2. The consumer located in the Master node in the`delay expansion` will 
consume the delayed messages from the delayed topic. After writing the message 
to commitLog, it will return `consume success`.
   3. There will be another thread to save the message from commitLog to 
RocksDB.
   4. A thread will read out the expiring messages from RocksDB in advance and 
add them to the time wheel.
   5. Another thread will send the message to its original topic when the 
expiration time is reached. And write the delivered timestamp and message into 
commitLog to ensure that another slave node knows which message will be 
delivered from when it becomes the master node.
   
   **We want to know whether this solution is ok. If it meets the requirements, 
we will implement it according to the above architecture diagram**


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to