You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by Eason Chen <qq...@gmail.com> on 2019/08/27 06:17:18 UTC
[DISSCUSS] RIP-13 RocketMQ-RPC
RIP 13 RocketMQ RPC
Status
- Current State: Proposed
- Authors: EasonChen
- Shepherds: [author](qqeasonchen)
- Mailing List discussion:
- Pull Request: #PR_NUMBER
- Released: <relased_version>
Background & Motivation
RPC is a powerful technique for constructing distributed, client-server
based applications. Many companies use MQ system to constructing their
service bus, especially in financial industry. We need to implement a RPC
client based on MQ system ourselves because MQ system doesn’t support RPC
naturally. In current version of rocketmq project, producer client only
support to send a message to broker and cannot wait a response message
replied from consumer. We wish RocketMQ can provide a RPC client implement
to help developers building their applications conveniently and effectively.
Goals
- What problem is this proposal designed to solve?
(1) Design and implement a RPC interface based on RocketMQ Producer, which
support send a message and then wait a response message replied from
consumer.
(2) Design and Implement a consumer which can automatic or manually send a
reply message.
(3) Enable broker to push a message to an explicit producer.
- To what degree should we solve the problem?
We wish developers can use RocketMQ easily to constructing their
distributed applications which need RPC call.
Non-Goals
- What problem is this proposal NOT designed to solve?
In this phase, this rip only support a usable RPC call in most common
scenarios.
- Are there any limits of this proposal?
Users may need to tune some client and broker’s configurations to achieve a
better performance.
Changes
Architecture
We plan to add RPC implement into client and broker modules. In client
modules, we will add a RPC interface into DefaultMQProducer, and add reply
logic into DefaultMQPushConsumer. In broker modules, we will add a
processor to push reply message from consumer to explicit producer.
Interface Design/Change
- Method signature changes
Plan to add interfaces as follow:
Message request(final Message msg, final long timeout) throws
MQClientException, RemotingException, MQBrokerException,
InterruptedException;
Message request(final Message msg, final SendCallback sendCallback, final
long timeout) throws MQClientException, RemotingException,
InterruptedException;
Message request(final Message msg, final MessageQueueSelector selector,
final Object arg, final long timeout) throws MQClientException,
RemotingException, MQBrokerException, InterruptedException;
Message request(final Message msg, final MessageQueueSelector selector,
final Object arg, final SendCallback sendCallback, final long timeout)
throws MQClientException, RemotingException, InterruptedException;
Message request(final Message msg, final MessageQueue mq, final long
timeout) throws MQClientException, RemotingException, MQBrokerException,
InterruptedException;
Message request(final Message msg, final MessageQueue mq, final
SendCallback sendCallback, long timeout) throws MQClientException,
RemotingException, InterruptedException;
- Method behavior changes
No issue
- CLI command changes
No issue
- Log format or content changes
No issue
Compatibility, Deprecation, and Migration Plan
- No issue
Implementation Outline
We will implement the proposed changes by *1* phases.
Phase 1
1. Implement RPC feature in Producer
2. Implement RPC feature in Consumer
3. Implement RPC feature in Broker