You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by "Jason.Chen" <ch...@foxmail.com> on 2022/03/16 13:32:19 UTC

回复: [DISCUSS] RIP-35 queue service framework(QSF)

sure:)


Taking a real business system (label system) as an example, when a&nbsp;label&nbsp;object is changed in the&nbsp;label&nbsp;system, an event notification needs to be initiated to inform the&nbsp;label&nbsp;search system of the change information, so that the&nbsp;label&nbsp;search system can update the search index.&nbsp;


This is a classic weak dependency that requires message decoupling. Using the classic solution, we need to write code to manage the mq infrastructure, assemble change objects, and send change messages on the message sender side; on the message receiver side, we also need to write code to parse the change objects and process the change messages. If you need features like extactly once consuming, it's even more cumbersome, and inevitably couples infrastructure management code and business code.&nbsp;


With QSF, we only need to declare the business interface and implement business logic, and annotate the interface implementation class with @QSFProvider, and annotate @QSFConsumer at the interface reference. A mq-based cross-system asynchronous call can be done&nbsp;like a local method call, like this:


// LabelService.java
public interface LabelService {
&nbsp; &nbsp; void labelModified(LabelInfoDTO labelDTO);
}



//&nbsp;LabelServiceImpl.java
@QSFProvider(topic = "topic_label", consumerId = "cid_topic_label", tags = "label_modified")
@Slf4j
public class&nbsp;LabelServiceImpl implements&nbsp;LabelService&nbsp;{


&nbsp; &nbsp; @Override
&nbsp; &nbsp; public void&nbsp;labelModified(LabelInfoDTO&nbsp;labelDTO) {
&nbsp; &nbsp; &nbsp; &nbsp; //business logic
&nbsp; &nbsp; }
}



//LabelManager.java
@QSFConsumer(topic = "topic_label", tag = "label_modified")
private LabelService labelService;


public boolean updateLable(LabelInfoDTO&nbsp;labelDTO){
// main process:update label logic
...
...


// edge process:inform label modified
labelService.labelModified(labelDTO);

}


------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "dev"                                                                                    <yukon@apache.org&gt;;
发送时间:&nbsp;2022年3月16日(星期三) 晚上8:23
收件人:&nbsp;"dev"<dev@rocketmq.apache.org&gt;;

主题:&nbsp;Re: [DISCUSS] RIP-35 queue service framework(QSF)



Could you please provide some demos to show how we use QSFProducer/Consumer?

On Wed, Mar 16, 2022 at 6:49 PM Jason.Chen <chenhuanzu@foxmail.com&gt; wrote:

&gt; I am sorry that the RIP mail format is incorrect, and i write a
&gt; well-formed google doc version here:
&gt;
&gt;
&gt; https://docs.google.com/document/d/10wSe24TAls7J9y0Ql4MYo73FX8g1aX9guoxBxzQhJgg
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; RIP 35 queue service framework(QSF)
&gt;
&gt; Status
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current State: Proposed
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Authors: booom( booom (jason) · GitHub)
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Shepherds: yukon( zhouxinyu (yukon) · GitHub)
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mailing List discussion: dev@rocketmq.apache.org
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pull Request:
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Released:&amp;nbsp;
&gt;
&gt; Background &amp;amp; Motivation
&gt;
&gt; What do we need to do
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Will we add a new module? Yes.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Will we add new APIs? No.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Will we add new feature? Yes.
&gt;
&gt; Why should we do that
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Are there any problems of our current project?
&gt;
&gt; The current mq client API is intrusive, to send message or consume
&gt; message, we should code to manage the mq infrastructure, and mixed it up
&gt; with our business logic codes.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What can we benefit proposed changes?
&gt;
&gt; 1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Encapsulate mq client API to support method invoking style usage.
&gt;
&gt; 2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The encapsulation is easily extensible, to support
&gt; idempotence/eventually consistent/ fluid control extensions and so on.
&gt;
&gt; 3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Isolate the mq client manage code and the business logic code, to
&gt; help mq users improve their systems’ maintainability.
&gt;
&gt; Goals
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What problem is this proposal designed to solve?
&gt;
&gt; Unobtrusive mq client usage, and easily extensible to support
&gt; idempotence/eventually consistent/ fluid control extensions and so on.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To what degree should we solve the problem?
&gt;
&gt; 100%.
&gt;
&gt; Non-Goals
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What problem is this proposal NOT designed to solve?
&gt;
&gt; 1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add new features to classics mq client.
&gt;
&gt; 2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Affect compatibility.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Are there any limits of this proposal?
&gt;
&gt; Only QSF(queue service framework) users will benefit.
&gt;
&gt; Changes
&gt;
&gt; Architecture
&gt;
&gt; To simplify a process, we need to consider what information is essential
&gt; and must be provided by users to execute this process? How to properly
&gt; organize this information so that it is most user-friendly?&amp;nbsp;
&gt;
&gt;
&gt; Along this thinking path, we have extracted the necessary parameters for
&gt; mq calls and organized them into the java annotations @QSFConsumer and
&gt; @QSFProvider. After that, through the extension support of spring container
&gt; in each stage of bean life cycle, we can process @QSFConsumer @QSFProvider
&gt; annotation in BeanPostProcessor, extract method invocation information to
&gt; method invocation information object MethodInvokeInfo and send it out, and
&gt; locate it through MethodInvokeInfo at the message receiving endpoint. The
&gt; bean where the call is made, the method where it is located, the parameters
&gt; used, and then the method is called by reflection.
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; Interface Design/Change
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method signature changes
&gt;
&gt; ○&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;nbsp; &amp;nbsp; method name
&gt;
&gt; ○&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;nbsp; &amp;nbsp; parameter list
&gt;
&gt; ○&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;nbsp; &amp;nbsp; return value
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method behavior changes
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLI command changes
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Log format or content changes
&gt;
&gt; Nothing.
&gt;
&gt; &amp;nbsp;Compatibility, Deprecation, and Migration Plan
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Are backward and forward compatibility taken into
&gt; consideration?
&gt;
&gt; Yes.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Are there deprecated APIs?
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; How do we do migration?
&gt;
&gt; Upgrade normally, no additional migration required.
&gt;
&gt; Implementation Outline
&gt;
&gt; We will implement the proposed changes by 1 phase. (QSF is implemented and
&gt; works well in our project)
&gt;
&gt; Phase 1
&gt;
&gt;
&gt; Complete the QSF mq client encapsulation.
&gt;
&gt;
&gt;
&gt; Complete the QSF idempotency support
&gt;
&gt;
&gt; Rejected Alternatives
&gt;
&gt; There are no other alternatives.
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; ------------------&amp;nbsp;原始邮件&amp;nbsp;------------------
&gt; 发件人:
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Jason.Chen"
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <
&gt; chenhuanzu@foxmail.com&amp;gt;;
&gt; 发送时间:&amp;nbsp;2022年3月16日(星期三) 中午12:55
&gt; 收件人:&amp;nbsp;"dev"<dev@rocketmq.apache.org&amp;gt;;
&gt;
&gt; 主题:&amp;nbsp;[DISCUSS] RIP-35 queue service framework(QSF)
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; Status
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Current State: Proposed
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Authors: booom( booom (jason) · GitHub)
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Shepherds: yukon( zhouxinyu (yukon) · GitHub)
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Mailing List discussion:
&gt; dev@rocketmq.apache.org
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Pull Request:
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Released: <relased_version&amp;gt;
&gt;
&gt; Background &amp;amp; Motivation
&gt;
&gt; What do we need to do
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Will we add a new module? Yes.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Will we add new APIs? No.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Will we add new feature? Yes.
&gt;
&gt; Why should we do that
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Are there any problems of our current project?
&gt;
&gt; The current mq client API is intrusive, to send message or consume
&gt; message, we should code to manage the mq infrastructure, and mixed it up
&gt; with our business logic codes.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; What can we benefit proposed changes?
&gt;
&gt; 1.&amp;nbsp;&amp;nbsp; &amp;nbsp; Encapsulate mq client API to support method invoking
&gt; style usage.
&gt;
&gt; 2.&amp;nbsp;&amp;nbsp; &amp;nbsp; The encapsulation is easily extensible, to support
&gt; idempotence/eventually consistent/ fluid control extensions and so on.
&gt;
&gt; 3.&amp;nbsp;&amp;nbsp; &amp;nbsp; Isolate the mq client manage code and the business
&gt; logic code, to help mq users improve their systems’ maintainability.
&gt;
&gt; &amp;nbsp;
&gt;
&gt; Goals
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; What problem is this proposal designed to solve?
&gt;
&gt; Unobtrusive mq client usage, and easily extensible to support
&gt; idempotence/eventually consistent/ fluid control extensions and so on.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; To what degree should we solve the problem?
&gt;
&gt; 100%.
&gt;
&gt; Non-Goals
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; What problem is this proposal NOT designed to
&gt; solve?
&gt;
&gt; 1.&amp;nbsp;&amp;nbsp; &amp;nbsp; Add new features to classics mq client.
&gt;
&gt; 2.&amp;nbsp;&amp;nbsp; &amp;nbsp; Affect compatibility.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Are there any limits of this proposal?
&gt;
&gt; Only QSF(queue service framework) users will benefit.
&gt;
&gt; Changes
&gt;
&gt; Architecture
&gt;
&gt; Interface Design/Change
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Method signature changes
&gt;
&gt; ○&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; method name
&gt;
&gt; ○&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; parameter list
&gt;
&gt; ○&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return value
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Method behavior changes
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; CLI command changes
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Log format or content changes
&gt;
&gt; Nothing.
&gt;
&gt; &amp;nbsp;Compatibility, Deprecation, and Migration Plan
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Are backward and forward compatibility taken
&gt; into consideration?
&gt;
&gt; Yes.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Are there deprecated APIs?
&gt;
&gt; Nothing.
&gt;
&gt; ●&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; How do we do migration?
&gt;
&gt; Upgrade normally, no additional migration required.
&gt;
&gt; Implementation Outline
&gt;
&gt; We will implement the proposed changes by 1 phase. (QSF is implemented and
&gt; works well in our project)
&gt;
&gt; Phase 1
&gt;
&gt; Complete&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the QSF mq client encapsulation.
&gt;
&gt; Complete&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the QSF idempotency support
&gt;
&gt; Rejected Alternatives
&gt;
&gt; There are no other alternatives.