Skip to content

Conversation

@yanrongzhen
Copy link
Contributor

@yanrongzhen yanrongzhen commented Nov 15, 2023

Fixes #4411 .

Modifications

  • Add EventMesh DingDing sink connnector.
  • Add unit test for sink connector.
  • Support sending text messages/Markdown messages from EventMesh to DingTalk chat.

Sample image (Plain text):
image

Sample image (Markdown text):
image

dingding doc: https://open.dingtalk.com/document/orgapp/the-robot-sends-a-group-message


  • 新增EventMesh 钉钉sink connector.
  • 新增sink connector的单元测试
  • 支持从EventMesh发送文本消息/MardDown消息到钉钉聊天.

发送样例图 (纯文本消息):
image

发送样例图 (Markdown消息):
image

文档参考: https://open.dingtalk.com/document/orgapp/the-robot-sends-a-group-message

@codecov
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

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

Comparison is base (13f4d98) 16.62% compared to head (2273577) 16.80%.
Report is 1 commits behind head on master.

❗ Current head 2273577 differs from pull request most recent head 803b0e7. Consider uploading reports for the commit 803b0e7 to get more accurate results

Files Patch % Lines
...dingding/sink/connector/DingDingSinkConnector.java 65.38% 24 Missing and 3 partials ⚠️
...nnector/dingding/server/DingDingConnectServer.java 0.00% 6 Missing ⚠️
...r/dingding/config/DingDingConnectServerConfig.java 0.00% 3 Missing ⚠️
...ctor/dingding/sink/config/SinkConnectorConfig.java 71.42% 2 Missing ⚠️
...ector/dingding/sink/config/DingDingSinkConfig.java 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4557      +/-   ##
============================================
+ Coverage     16.62%   16.80%   +0.17%     
- Complexity     1603     1626      +23     
============================================
  Files           743      749       +6     
  Lines         28575    28683     +108     
  Branches       2479     2487       +8     
============================================
+ Hits           4752     4821      +69     
- Misses        23372    23408      +36     
- Partials        451      454       +3     

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

@yanrongzhen yanrongzhen requested a review from pandaapo November 15, 2023 12:05
.orElse("EventMesh-Message");
contentMap.put("title", title);
contentMap.put("text", String.valueOf(record.getData()));
}
Copy link
Member

@pandaapo pandaapo Nov 15, 2023

Choose a reason for hiding this comment

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

For other illegal ConnectRecord, could you report an error or output logs to continue directly? Now it's sending an empty Map to DingDing.

对于其他不合法的ConnectRecord,这里是不是可以报错或者输出日志直接continue?现在是给钉钉发送空的Map。

@yanrongzhen yanrongzhen requested a review from pandaapo November 15, 2023 13:04
.orElse("EventMesh-Message");
contentMap.put("title", title);
contentMap.put("text", String.valueOf(record.getData()));
}
Copy link
Member

Choose a reason for hiding this comment

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

What I mean is that when the DingDingMessageTemplateType in ConnectRecord is illegal, the contentMap sent to DingTalk is empty. Do you need to handle it? Error reported or ignored after logging.

我的意思是当ConnectRecordDingDingMessageTemplateType不合法,这时给钉钉发了空的contentMap。需不需要处理下?报错或者打日志后忽略。

Copy link
Contributor Author

@yanrongzhen yanrongzhen Nov 15, 2023

Choose a reason for hiding this comment

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

No need to deal with it, the enumeration class itself will throw an exception when illegal type.


不用处理,枚举类内部遇到不合法的类型本身会抛异常。

@xwm1992 xwm1992 merged commit fc900e5 into apache:master Nov 16, 2023
@pandaapo pandaapo added this to the 1.10 milestone Dec 5, 2023
@xwm1992 xwm1992 changed the title [ISSUE #4411] Add DingDing sink connnector. [ISSUE #4411] Add DingDing sink connector. Dec 12, 2023
xuhongjia pushed a commit to Deckers-Ohana/eventmesh that referenced this pull request Mar 13, 2025
* Add dingding sink connector.

* fix: Remove unused config.

* fix: Remove unused config.

* fix: review

* Add example config.

* fix: review

* fix: continue when record data is null.
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.

[Feature] Add Dingding sink connector

3 participants