[improve][broker] PIP-371: Support for request-reply model that implements RPC calls #23194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PIP: #23143
This is a native implementation of the request-reply model in pulsar.
Although at present, there is no support from many people in the email discussion. But I think things still have to have a result.
I am sorry that I am just a personal developer. I have not done pulsar-related work in the company, and I have no business scenarios to test. The implementation code is as follows, if you are interested in this request-reply synchronization model, or if you have the usage scenario of this function. Can help with internal testing.
This is just a simple implementation, there are many exception handling or the metrics is not perfect. You are still welcome to discuss your questions on the mailing list or pr.
Motivation
As we known,Pulsar's current asynchronous publish-subscribe model serves well for decoupled message distribution, but it lacks a native mechanism for handling synchronous interactions typical of Remote Procedure Calls (RPC).
This request-reply model can greatly enhance the utility of Pulsar. We can then use Pulsar as RPC.
Why would we use Pulsar for this RPC call?
request.Requestand existing send function of pulsar can be mixed to same topic. This means that the user can choose, and the call to the server side (consumer) can be asynchronous or synchronous, which is controlled by the user flexibly.Modifications
Please read the https://github.com/apache/pulsar/pull/23143/files.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: