Open syhleo opened 4 months ago
the related documentation:语雀
Easy access. Business parties control only a few client configurations, such as enableGraySwitch
and grayTag
, to seamlessly access RocketMQ's gray-scale publishing capabilities, enabling full-link gray-scale publishing.Specific can refer to org.apache.rocketmq.example.gray
We know that in practical applications, full-link gray scale publishing scenario is very common, and message queue as one of the links should also have this capability, this scheme makes RocketMQ4.x and RocketMQ5.x native support message gray scale publishing function. Compared with existing solutions in the industry, this solution does not require additional shadow Topic/Group. There is also no need to transform grayscale tag/UserProperty, etc. (ps: When the scale of the business is relatively large, the grayscale function is implemented by adding a topic or group. On the one hand, there is a critical problem, that is, when the grayscale verification is switched to prod, messages may be missed for consumption, which is unacceptable. On the other hand, there is the cost issue. Imagine the cost of doubling each topic and group, which cannot be ignored.) The solution uses gray partition to solve the problem of message isolation and switching connection at low cost, and has low intrusion to RocketMQ. Just add a few client configurations and access grayscale policies to allow businesses to seamlessly access RocketMQ grayscale publishing capabilities.
The solution has been widely applied and verified in our projects, which confirms its reliability, security, and stability.
How to avoid non-grayscale consumer consumption when message retry occurs
How to avoid non-grayscale consumer consumption when message retry occurs
If it is a retry topic, the equal-allocation policy is used (the retry topic goes to the internal callback broker, which queue is written to is random)
所以在这个场景下会有可能消息互串,比如prod实例消费0,1,2,3队列,gray实例消费4,5,6,7队列,如果gray实例消费触发消息重试,消息会默认回到0队列,这样会导致prod实例消费到灰度消息。
Before Creating the Enhancement Request
Refer RIP-72 detail link: 语雀
Summary
The solution provides an extensible message grayscale solution for implementing message grayscale publishing that supports
RocketMQ 4.x
andRocketMQ 5.x
. It is compatible withPOP
consumption mode andPush
consumption mode. No matter the client-rebalance or server-rebalance, the solution can realize the message gray level in a lightweight way. The solution has been widely applied and verified in our projects, which confirms its reliability, security, and stability.Motivation
Describe the Solution You'd Like
enableGraySwitch
andgrayTag
.enableGraySwitch
Indicates whether the grayscale message is enabled. grayTag indicates whether the client is a grayscale client.grayTag
takes effect only whenenableGraySwitch
is enabled. The solution adds two configuration items that make it easy for the RocketMQ consumer to determine whether a client is a grayscale client.enableGraySwitch
andgrayTag
are both true), its clientId will contain the@gray
identifier.SelectMessageQueueByGray
policy is implemented specifically to ensure that producers send messages accurately to the specifiedMessageQueue
when they are sent.AllocateMessageQueueAveragely
, compatible RocketMQ 4 x and 5. X version different versions, and different consumption patterns (such as POP/Push). The core idea is that during rebalancing, grayscale clients are distinguished from non-grayscale clients by whether or not there is a@gray
identifier in theclientId
string, ensuring that grayscale clients consume from grayscale queues and non-grayscale clients consume from non-grayscale queues.Describe Alternatives You've Considered
/
Additional Context
Gray scale partition
This solution is lightweight, easy to access and upgrade controllable message grayscale scheme. Compatible with RocketMQ4.x and RocketMQ5.x versions.
Easy access. Business parties control only a few client configurations, such as
enableGraySwitch
andgrayTag
, to seamlessly access RocketMQ's gray-scale publishing capabilities, enabling full-link gray-scale publishing.Specific can refer toorg.apache.rocketmq.example.gray