Denovo1998 opened a new pull request, #23194: URL: https://github.com/apache/pulsar/pull/23194
<!-- If the PR belongs to a PIP, please add the PIP link here --> PIP: https://github.com/apache/pulsar/pull/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. <!-- Details of when a PIP is required and how the PIP process work, please see: https://github.com/apache/pulsar/blob/master/pip/README.md --> ### 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? - This proposal to achieve the function is `request`. `Request` and 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. - Similar enhancements can be implemented in [pulsar-spring](https://github.com/spring-projects/spring-pulsar), just like [rocketmq-spring#209](https://github.com/apache/rocketmq-spring/pull/209). However, this proposal does not use the solution of storing the request and reply result topics. After the consumer processing request is message, the processing result is directly sent to the broker and finally passed to the original producer. This call of link has one less message publishing and subscription of reply result, and its performance is higher than that of other request-reply models. - You can directly use Pulsar's own delaying messages, that is, you can execute RPC regularly. - You can directly use Pulsar's own load balancing mechanism. - You can directly use Pulsar's own message consumption throttling mechanism. - You can directly use Pulsar's own expansion and contraction mechanism. - You can directly use Pulsar's own message call tracking, monitoring, and logging mechanisms. ### Modifications Please read the https://github.com/apache/pulsar/pull/23143/files. ### Verifying this change - [x] Make sure that the change passes the CI checks. *(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:)* - *Added integration tests for end-to-end deployment with large payloads (10MB)* - *Extended integration test for recovery after broker failure* ### Does this pull request potentially affect one of the following parts: <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> *If the box was checked, please highlight the changes* - [ ] Dependencies (add or upgrade a dependency) - [ ] The public API - [ ] The schema - [ ] The default values of configurations - [ ] The threading model - [ ] The binary protocol - [ ] The REST endpoints - [ ] The admin CLI options - [ ] The metrics - [ ] Anything that affects deployment ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc` <!-- Your PR contains doc changes. --> - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-complete` <!-- Docs have been already added --> ### Matching PR in forked repository PR in forked repository: <!-- ENTER URL HERE --> <!-- After opening this PR, the build in apache/pulsar will fail and instructions will be provided for opening a PR in the PR author's forked repository. apache/pulsar pull requests should be first tested in your own fork since the apache/pulsar CI based on GitHub Actions has constrained resources and quota. GitHub Actions provides separate quota for pull requests that are executed in a forked repository. The tests will be run in the forked repository until all PR review comments have been handled, the tests pass and the PR is approved by a reviewer. --> -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
