Spring Cloud数据流转换

时间:2018-09-20 19:04:29

标签: spring-cloud-stream spring-el spring-cloud-dataflow

我有一个json文档:我需要提取CreateTime和CorrelationId两者结合并记录,示例json文档是belwo {     “ MessageId”:“ a156155f-1767-43a5-a6c0-01381291a64a”,     “ MessageVersion”:“ 1.0”,     “ CreateTime”::“ 2018-07-26T17:59:47.6303585Z”,     “ PublishTime”:“ 2018-07-26T17:59:47.6323632Z”,     “ TenantId”:“ SF”,     “ UserId”:“ jdoe”,     “ CorrelationId”:“ 15125215215126”,     “ MessageNamespace”:{         “ BusinessUnit”:“ csg-acs”,         “产品”:“ dp”,         “模块”:“提交帐单”,         “ MessageType”:“经过帐单审查”     },     “标题”:{},     “ SchemaName”:“ csg.acs.bill”,     “ SchemaVersion”:“ 1.0”,     “信息”: {         “ BillId”:“ bill-9939”     },     “主机”:{         “ MachineName”:“ JB97316-D”,         “ IPAddress”:“ 172.20.24.37”,         “ Region”:“ us”,         “ ProcessName”:“发布者”,         “ ProcessId”:15804,         “ EbeSdkVersion”:“ .NET,Mitchell.Corp.EnterpriseBusinessEvents.Message,0.1.0-dev-00012”,         “ OperatingSystemVersion”:“ Microsoft Windows NT 6.2.9200.0”     } }

当前实现我有以下转换 1)转换--expression =#jsonPath(payload,'$。CreateTime')>:extractedJson 2)transformCorrId:transform --expression =#jsonPath(payload,'$。CorrelationId')>:extractedJson

3):extractedJson>日志

因此,在此实现中,日志上的输出看起来像两行 2018-09-20 18:12:43.755信息25880 --- [-L-1]日志接收器:15125215215126  2018-09-20 18:12:43.756信息25880 --- [-L-1]日志接收器:2018-07-26T17:59:47.6303585Z

但是,我们希望将correlationIdId和creationTime组合在一起(类似于逗号分隔),例如 15125215215126,2018-07-26T17:59:47.6303585Z在发送到日志接收器之前,但不确定如何使用转换进行合并,因为转换将从两个输入接收有效载荷变量。因此,需要有关spEL表达式的帮助

谢谢您的帮助。

0 个答案:

没有答案