Skip to content

[ISSUE#4552] Add example for spring connector sdk. #4553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

yanrongzhen
Copy link
Contributor

Fixes #4552 .

Modifications

Add example for spring connector sdk.

Copy link

codecov bot commented Nov 10, 2023

Codecov Report

Merging #4553 (989e386) into master (3a580dc) will increase coverage by 0.09%.
Report is 3 commits behind head on master.
The diff coverage is 0.00%.

❗ Current head 989e386 differs from pull request most recent head f63c5b1. Consider uploading reports for the commit f63c5b1 to get more accurate results

@@             Coverage Diff              @@
##             master    #4553      +/-   ##
============================================
+ Coverage     16.30%   16.39%   +0.09%     
- Complexity     1592     1603      +11     
============================================
  Files           747      747              
  Lines         28965    28965              
  Branches       2541     2541              
============================================
+ Hits           4723     4750      +27     
+ Misses        23793    23764      -29     
- Partials        449      451       +2     
Files Coverage Δ
...ocol/http/processor/SendAsyncMessageProcessor.java 0.00% <0.00%> (ø)
...e/eventmesh/protocol/http/HttpProtocolAdaptor.java 5.26% <0.00%> (ø)

... and 4 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
Copy link
Member

@pandaapo pandaapo Nov 10, 2023

Choose a reason for hiding this comment

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

What is the role of exclude = {DataSourceAutoConfiguration.class}?


@Override
public void onSuccess(SendResult sendResult) {
log.info("send message success! msgId={}, topic={}", sendResult.getMessageId(), sendResult.getTopic());
Copy link
Member

@pandaapo pandaapo Nov 10, 2023

Choose a reason for hiding this comment

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

The SendMessageCallback here is not a callback when sending a message succeeds or fails, but a callback when Source obtains the message successfully or unsuccessfully after successfully sending the message. Could you optimize the log content to avoid misleading users?

这里的SendMessageCallback不是发送消息成功/失败的回调,是发送消息成功后,被Source获取成功/失败后的回调。是不是可以修改下日志内容以免误导用户?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not necessarily that the message was sent successfully. The trigger timing here is that when the SourceWorker sends the message to the eventmesh, there is an exception.


不一定是发送消息成功, 这里的触发时机是 SourceWorker发送消息到eventmesh时, 出现了异常。

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for correcting me. You are right. Is this log easy for users to mistake it for triggering onSuccess() when SpringSourceConnector.send() sending messages successfully?

谢谢纠正,你是对的。现在的日志是不是容易让用户误以为是SpringSourceConnector.send()发送消息成功时触发onSuccess()


@Override
public void onException(SendExcepionContext sendExcepionContext) {
log.info("send message failed!", sendExcepionContext.getCause());
Copy link
Member

Choose a reason for hiding this comment

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

Same as above. When this method is executed, the message must have been successfully sent.

和上面一样。当该方法被执行时,消息肯定是发送成功的。

Copy link
Member

Choose a reason for hiding this comment

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

Is this log easy for users to mistake it for triggering onException() when SpringSourceConnector.send() sending messages failed?

现在的日志是不是容易让用户误以为是SpringSourceConnector.send()发送消息失败时触发onException()

@yanrongzhen yanrongzhen requested a review from pandaapo November 13, 2023 04:40
@xwm1992 xwm1992 merged commit 013512b into apache:master Nov 13, 2023
xuhongjia pushed a commit to Deckers-Ohana/eventmesh that referenced this pull request Mar 13, 2025
* Feat: Add example for spring.

* fix: Remove exclude configuration.

* fix: fix log
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.

[Enhancement] Add eventmesh spring examples.
3 participants