Skip to content

Conversation

@mxsm
Copy link
Member

@mxsm mxsm commented Dec 14, 2023

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

@xwm1992 xwm1992 added this to the 1.10 milestone Dec 15, 2023
@codecov
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (b85a58c) 17.39% compared to head (fdf517f) 17.39%.
Report is 1 commits behind head on master.

Files Patch % Lines
...sh/client/grpc/consumer/EventMeshGrpcConsumer.java 48.48% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4653      +/-   ##
============================================
- Coverage     17.39%   17.39%   -0.01%     
- Complexity     1757     1758       +1     
============================================
  Files           797      797              
  Lines         29774    29787      +13     
  Branches       2573     2575       +2     
============================================
+ Hits           5178     5180       +2     
- Misses        24118    24129      +11     
  Partials        478      478              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* @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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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推送给消费者吗?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()其实作用不大”吗?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()方法。

@pandaapo pandaapo merged commit f17b82e into apache:master Dec 15, 2023
@mxsm mxsm deleted the bug-mxsm-4652 branch December 15, 2023 13:51
xuhongjia pushed a commit to Deckers-Ohana/eventmesh that referenced this pull request Mar 13, 2025
…eartBeat throw NPE (apache#4653)

* [ISSUE apache#4652]Fix EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE

* fix code style

* fix runtime code style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] EventMeshGrpcConsumer subscribe webhook send heartBeat throw NPE

3 participants