Skip to content

Commit

Permalink
Merge branch 'master' into pil0txia_feat_4501
Browse files Browse the repository at this point in the history
  • Loading branch information
Pil0tXia committed Dec 10, 2023
2 parents f915dd5 + 24873dd commit 0b4118b
Show file tree
Hide file tree
Showing 123 changed files with 18,682 additions and 487 deletions.
2 changes: 2 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ header:
copyright-owner: Apache Software Foundation

paths-ignore:
- 'eventmesh-operator/config/crd/bases'
- 'eventmesh-operator/config/rbac'
- '.github/PULL_REQUEST_TEMPLATE'
- '.gitmodules'
- '**/.gitkeep'
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ subprojects {
dependency "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.0"
dependency "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.0"

dependency "com.squareup.okhttp3:okhttp:3.14.9"

dependency "org.asynchttpclient:async-http-client:2.12.0"
dependency "org.apache.httpcomponents:httpclient:4.5.13"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,4 @@ public class Constants {
public static final String OS_WIN_PREFIX = "win";

public static final String DEFAULT = "default";

public static final String FEISHU_SEND_MESSAGE_API = "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=";

public static final String FEISHU_RECEIVE_ID = "receive_id";

public static final String FEISHU_MSG_TYPE = "msg_type";

public static final String FEISHU_CONTENT = "content";

public static final String FEISHU_UUID = "uuid";

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ public class ProtocolKey {

public static final String CLIENT_TYPE = "clienttype";

public static final String GRPC_RESPONSE_CODE = "status_code";
public static final String GRPC_RESPONSE_MESSAGE = "response_message";
public static final String GRPC_RESPONSE_CODE = "statuscode";
public static final String GRPC_RESPONSE_MESSAGE = "responsemessage";
public static final String GRPC_RESPONSE_TIME = "time";

public static final String SUB_MESSAGE_TYPE = "submessagetype";
public static final String SUB_REPLY_MESSAGE = "subscription_reply";

/**
* CloudEvents spec
*
Expand Down
6 changes: 4 additions & 2 deletions eventmesh-connectors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Add a new connector by implementing the source/sink interface using :
| [Dingtalk](eventmesh-connector-dingtalk) | Sink ||
| Email | Source ||
| Email | Sink ||
| FeiShu | Source ||
| [FeiShu](eventmesh-connector-feishu) | Sink ||
| Lark | Source ||
| [Lark](eventmesh-connector-lark) | Sink ||
| [File](eventmesh-connector-file) | Source ||
| [File](eventmesh-connector-file) | Sink ||
| Github | Source ||
Expand Down Expand Up @@ -66,4 +66,6 @@ Add a new connector by implementing the source/sink interface using :
| [Spring](eventmesh-connector-spring) | Sink ||
| WeCom | Source ||
| [WeCom](eventmesh-connector-wecom) | Sink ||
| WeChat | Source ||
| [WeChat](eventmesh-connector-wechat) | Sink ||
| More connectors will be added... | Source/Sink | N/A |
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
public interface ConnectRecordExtensionKeys {

String DINGTALK_TEMPLATE_TYPE_KEY = "dingtalktemplatetype";
String DINGTALK_TEMPLATE_TYPE = "dingtalktemplatetype";

String DINGTALK_MARKDOWN_MESSAGE_TITLE = "dingtalkmarkdownmessagetitle";
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,30 @@

public enum DingDingMessageTemplateType {

PLAIN_TEXT("sampleText"),
MARKDOWN("sampleMarkdown");
PLAIN_TEXT("text", "sampleText"),
MARKDOWN("markdown", "sampleMarkdown");

private final String templateType;

private final String templateKey;

DingDingMessageTemplateType(String templateKey) {
DingDingMessageTemplateType(String templateType, String templateKey) {
this.templateType = templateType;
this.templateKey = templateKey;
}

public String getTemplateType() {
return templateType;
}

public String getTemplateKey() {
return templateKey;
}

public static DingDingMessageTemplateType of(String templateKey) {
public static DingDingMessageTemplateType of(String templateType) {
return Arrays.stream(values())
.filter(v -> v.getTemplateKey().equals(templateKey))
.filter(v -> v.getTemplateType().equals(templateType))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("TemplateKey: " + templateKey + " not found."));
.orElseThrow(() -> new IllegalArgumentException("TemplateType: " + templateType + " not found."));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ public void put(List<ConnectRecord> sinkRecords) {
new OrgGroupSendHeaders();
orgGroupSendHeaders.xAcsDingtalkAccessToken = accessToken;

String templateTypeKey = record.getExtension(ConnectRecordExtensionKeys.DINGTALK_TEMPLATE_TYPE_KEY);
String templateTypeKey = record.getExtension(ConnectRecordExtensionKeys.DINGTALK_TEMPLATE_TYPE);
if (null == templateTypeKey || "null".equals(templateTypeKey)) {
templateTypeKey = DingDingMessageTemplateType.PLAIN_TEXT.getTemplateKey();
templateTypeKey = DingDingMessageTemplateType.PLAIN_TEXT.getTemplateType();
}
DingDingMessageTemplateType templateType = DingDingMessageTemplateType.of(templateTypeKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public void testSendMessageToDingDing() throws Exception {
RecordOffset offset = new RecordOffset();
ConnectRecord connectRecord = new ConnectRecord(partition, offset,
System.currentTimeMillis(), "Hello, EventMesh!".getBytes(StandardCharsets.UTF_8));
connectRecord.addExtension(ConnectRecordExtensionKeys.DINGTALK_TEMPLATE_TYPE_KEY,
DingDingMessageTemplateType.PLAIN_TEXT.getTemplateKey());
connectRecord.addExtension(ConnectRecordExtensionKeys.DINGTALK_TEMPLATE_TYPE,
DingDingMessageTemplateType.PLAIN_TEXT.getTemplateType());
records.add(connectRecord);
}
connector.put(records);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 0b4118b

Please sign in to comment.