You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "mxsm (via GitHub)" <gi...@apache.org> on 2023/12/14 16:23:29 UTC

[PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

mxsm opened a new pull request, #4653:
URL: https://github.com/apache/eventmesh/pull/4653

   …at throw NPE
   
   <!--
   ### Contribution Checklist
   
     - Name the pull request in the form "[ISSUE #XXXX] Title of the pull request", 
       where *XXXX* should be replaced by the actual issue number.
       Skip *[ISSUE #XXXX]* if there is no associated github issue for this pull request.
   
     - Fill out the template below to describe the changes contributed by the pull request. 
       That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue. 
       Please do not mix up code from multiple issues.
     
     - Each commit in the pull request should have a meaningful commit message.
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, 
       leaving only the filled out template below.
   
   (The sections below can be removed for hotfixes of typos)
   -->
   
   <!--
   (If this PR fixes a GitHub issue, please add `Fixes #<XXX>` or `Closes #<XXX>`.)
   -->
   
   Fixes #4652 
   
   ### Motivation
   
   *Explain the content here.*
   *Explain why you want to make the changes and what problem you're trying to solve.*
   
   - Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (yes / no)
   - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   - If a feature is not applicable for documentation, explain why?
   - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#discussion_r1427532298


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   This is my question. What is the correlation between using this method for subscription and the Webhook mechanism? Will EventMesh push new messages through this URL?
   
   这是我的疑问,使用该方法进行订阅和Webhook机制是什么关联?是产生新消息时,EventMesh会通过该URL进行推送吗?



##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   This is my question. What is the correlation between using this method for subscription and the Webhook mechanism? Will EventMesh push consumers through this URL when new messages are generated?
   
   这是我的疑问,使用该方法进行订阅和Webhook机制是什么关联?是产生新消息时,EventMesh会通过该URL推送给消费者吗?



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#discussion_r1427532298


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   This is my question. What is the correlation between using this method for subscription and the Webhook mechanism? Will EventMesh push new messages through this URL?
   
   这是我的疑问,使用该方法进行订阅和Webhook机制是什么关联?是产生新消息时,EventMesh会通过该URL进行推送吗?



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#issuecomment-1857262075

   ## [Codecov](https://app.codecov.io/gh/apache/eventmesh/pull/4653?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: `17 lines` in your changes are missing coverage. Please review.
   > Comparison is base [(`b85a58c`)](https://app.codecov.io/gh/apache/eventmesh/commit/b85a58cc6efefbaf8554e9c9244b0595634a1200?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 17.39% compared to head [(`fdf517f`)](https://app.codecov.io/gh/apache/eventmesh/pull/4653?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 17.37%.
   > Report is 1 commits behind head on master.
   
   | [Files](https://app.codecov.io/gh/apache/eventmesh/pull/4653?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...sh/client/grpc/consumer/EventMeshGrpcConsumer.java](https://app.codecov.io/gh/apache/eventmesh/pull/4653?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLXNka3MvZXZlbnRtZXNoLXNkay1qYXZhL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9ldmVudG1lc2gvY2xpZW50L2dycGMvY29uc3VtZXIvRXZlbnRNZXNoR3JwY0NvbnN1bWVyLmphdmE=) | 48.48% | [17 Missing :warning: ](https://app.codecov.io/gh/apache/eventmesh/pull/4653?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4653      +/-   ##
   ============================================
   - Coverage     17.39%   17.37%   -0.02%     
   - Complexity     1757     1758       +1     
   ============================================
     Files           797      797              
     Lines         29774    29782       +8     
     Branches       2573     2573              
   ============================================
   - Hits           5178     5176       -2     
   - Misses        24118    24126       +8     
   - Partials        478      480       +2     
   ```
   
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/eventmesh/pull/4653?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#discussion_r1427638877


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   > > when there is no stream subscription, it is necessary to switch to a heartbeating method to resolve the issue.
   > 
   > Thank you for your answer. What does this sentence mean? Is it true that heartBeat() is only used for non stream subscriptions (webhook), and its effect is not significant when normal subscriptions are in progress?
   > 
   > 感谢您的解答。这句是什么意思?是说“heartBeat()只是用于非流的方式订阅(webhook),流方式订阅时该heartBeat()其实作用不大”吗?
   
   It is important to send heartbeats whether in webhook or stream mode, both of which are to keep the abstract ConsumerGroupClient of the runtime online. However, if the EventMeshGrpcConsumer only uses webhook subscriptions and not Stream subscriptions, then sending heartbeats can only be achieved by resubscribing through the subscribeWebhook method. If there are Stream subscriptions, both webhook subscriptions and Stream subscriptions can use Stream to send heartbeats to keep the runtime ConsumerGroupClient online.



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#discussion_r1427592935


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   > when there is no stream subscription, it is necessary to switch to a heartbeating method to resolve the issue.
   
   Thank you for your answer. What does this sentence mean? Is it true that heartBeat() is only used for non stream subscriptions (webhook), and its effect is not significant when normal subscriptions are in progress?
   
   感谢您的解答。这句是什么意思?是说“heartBeat()只是用于非流的方式订阅(webhook),流方式订阅时该heartBeat()其实作用不大”吗?



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo merged PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653


-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#discussion_r1427755288


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   So "it is necessary to switch to a heartbeating method" means using another heartbeat logic, which is `subscribeWebhook()` you extracted.
   
   所以“it is necessary to switch to a heartbeating method”意思是改用另一种心跳逻辑,即您提取出来的`subscribeWebhook()`方法。



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#discussion_r1427580565


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   > This is my question. What is the correlation between using this method for subscription and the Webhook mechanism? Will EventMesh push consumers through this URL when new messages are generated?
   > 
   > 这是我的疑问,使用该方法进行订阅和Webhook机制是什么关联?是产生新消息时,EventMesh会通过该URL推送给消费者吗?
   
   Yes, Previously, gRPC subscriptions were divided into two categories: normal subscription consumption (stream), and webhook subscriptions. These were primarily handled by the SubscribeProcessor. Within this, we can clearly see some validation for webhooks. When a producer sends a message, the runtime receives it and then sends it to the corresponding URL address provided during subscription via the URL given. Therefore, this is where the problem arises, and when there is no stream subscription, it is necessary to switch to a heartbeating method to resolve the issue.



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE #4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE (eventmesh)

Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4653:
URL: https://github.com/apache/eventmesh/pull/4653#discussion_r1427532298


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/EventMeshGrpcConsumer.java:
##########
@@ -93,27 +96,26 @@ public void init() {
         heartBeat();
     }
 
+    /**
+     * Subscribes to an event at a specified URL(Webhook).
+     *
+     * @param subscriptionItems The list of subscription items.
+     * @param url               The URL to subscribe to.
+     * @return A response containing information about the subscription result.
+     */
     public Response subscribe(final List<SubscriptionItem> subscriptionItems, final String url) {

Review Comment:
   This is my question. What is the correlation between using this method for subscription and the Webhook mechanism?
   
   这是我的疑问,使用该方法进行订阅和Webhook机制是什么关联?



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org