Skip to content

[Question] How to elegantly use the extension field in ConnectRecord to sink messages? #4567

@hhuang1231

Description

@hhuang1231

Search before asking

  • I had searched in the issues and found no similar issues.

Question

Currently I try to use connector-spring's soouce to send messages and then sink in DingTalk.

目前我尝试使用connector-spring的soouce来发送消息,然后在钉钉中下沉。

  • Since DingTalk requires special extension fields, I first need to add org.apache.eventmesh.connector.spring.source.connector.SpringSourceConnector#send(java.lang.Object, org.apache.eventmesh.openconnect.api. callback.SendMessageCallback) method, add the required extension fields to ConnectRecord

    由于钉钉需要特殊的扩展字段,所以我首先需要在org.apache.eventmesh.connector.spring.source.connector.SpringSourceConnector#send(java.lang.Object, org.apache.eventmesh.openconnect.api.callback.SendMessageCallback)方法,将需要的扩展字段添加进ConnectRecord

  • And due to CloudEvent's name conventions, I also have to convert the dingdingtemplatetypekey to all lowercase before I can put it into the extension of CloudEvent

    并且由于CloudEvent的命名约束,我也必须将dingdingtemplatetypekey转为全部小写,才能将其放入CloudEventextension

    image

  • And had to modify the source code of org.apache.eventmesh.openconnect.SourceWorker#convertRecordToEvent so that it can get extension from ConnectRecord and add it to CloudEvent

    并且不得不修改org.apache.eventmesh.openconnect.SourceWorker#convertRecordToEvent的源代码使其可以从ConnectRecord中得到extension并添加到CloudEvent

    image

    • In addition, I found that sinkWoker will call org.apache.eventmesh.openconnect.util.CloudEventUtil#convertEventToRecord when receiving events, thereby completing the conversion from CloudEvent's extension to ConnectorRecord's extension, and sourceWoker But they didn't do this. Why?

      另外我发现sinkWoker接收事件的过程中将会调用org.apache.eventmesh.openconnect.util.CloudEventUtil#convertEventToRecord,从而完成从CloudEventextension转换为ConnectorRecordextension,而sourceWoker却没有这么做,这是为什么呢?

      image

My doubts should be similar to #4560, and I hope to understand the community's current plans for this area.

我的疑惑与#4560 应该是类似的,我希望能够了解社区目前对于这一块的计划。

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions