我正在将现有的Mule 3应用程序迁移到Mule 4。在一个流中,我们与salesforce
交互(下面是Mule 3的代码):
<sfdc-composite:execute-composite-request config-ref="SFC" allOrNone="true" doc:name="Retrieve Composite"/>
Mule 3中的请求负载是:
{
{method=GET, url=/services/data/v43.0/query/?q=select xyz ..., referenceId=studentExtId}
{method=PATCH, url=/services/data/v43.0/sobjects/Student/@{studentId}, body={name=ABC}, refId=studentUpdate}
}
注意-这个mule 3是一个在生产中运行良好的现有api。它返回一个错误响应:
compositeResponse=[{body=[{errorCode=PROCESSING_HALTED, message=
The transaction was rolled back since another operation in the same transaction failed.}],
httpHeaders={}, httpStatusCode=400, referenceId=studentExtId},
{body=[{errorCode=PROCESSING_HALTED, message=Invalid reference specified.
No value for Student found in studentExtId.
Provided referenceId ('Student') must start with a letter or a number,
and it can contain only letters, numbers and underscores ('_').}], httpHeaders={},
httpStatusCode=400, referenceId=studentUpdate}]
我希望在骡子4中有相同的响应,但它不同。下面是mule 4的代码:
<salesforce-composite:execute-composite-request doc:name="composite request" config-ref="Composite_Config"/>
请求顺丰:
{
"compositeRequest": [
{
"method": "GET",
"url": "/services/data/v43.0/query/?q=select xyz ...",
"referenceId": "studentExtId"
},
{
"method": "PATCH",
"url": "/services/data/v43.0/sobjects/Student/@{studentId}, body={name=ABC}, refId=studentUpdate}
}
]
}
下面是Mule 4的响应:
{
"compositeResponse": [
{
"body": {
"totalSize": 0,
"done": true,
"records": [
]
},
"httpHeaders": {
},
"httpStatusCode": 200,
"referenceId": "studentExtId"
},
{
"body": [
{
"errorCode": "PROCESSING_HALTED",
"message": "Invalid reference specified.
No value for Student found in studentExtId. Provided referenceId ('Student') must start with a
letter or a number, and it can contain only letters, numbers and underscores ('_')."
}
],
"httpHeaders": {
},
"httpStatusCode": 400,
"referenceId": "studentUpdate"
}
]
}
所以在Mule 3的情况下,两个调用的响应都是400,而在Mule 4的情况下,第一个(GET)调用显示为成功(200),而第二个调用显示为错误(400)
我是Salesforce的新手,所以不确定骡子复合请求是否以这种方式行为,如果这是预期的?想知道为什么会有这种差异吗?由于
Mule 3和Mile 4不兼容。此外,Mule 4连接器使用了不同的设计,我们从头开始重写。可以预料,他们的行为会有所不同。您应该阅读两者的文档,以了解它们在行为上的差异。
在这种情况下,Mule 4版本似乎为请求中的每个子操作返回单独的响应,而Mule 3返回一个组合的响应。