我在 Visual Studio Code 中使用逻辑应用标准。
流程很简单:
触发器:Servicebus(应用程序内)当消息在队列中可用时(窥视锁定)
下一步操作:HTTP(调用 Beeceptor,调试消息)
问题:
当我在 HTTP 操作中使用属性“内容”或“消息 ID”(以调试值)时,出现以下错误:
错误:
[2024-04-07T11:11:32.281Z] Executing 'Functions.WorkflowDispatcher' (Reason='(null)', Id=dd3e3863-a60d-4e5d-a314-e644aef00909)
[2024-04-07T11:11:32.471Z] Executed 'Functions.WorkflowDispatcher' (Failed, Id=dd3e3863-a60d-4e5d-a314-e644aef00909, Duration=187ms)
[2024-04-07T11:11:32.474Z] System.Private.CoreLib: Exception while executing function: Functions.WorkflowDispatcher. Microsoft.Azure.Workflows.Worker.Common: Unable to process template language expressions in action 'HTTP' inputs at line '0' and column '0'. Current flow run operation failed. Exception: '***sanitized***'.
[2024-04-07T11:11:32.678Z] Executed 'Functions.queueconsumer' (Failed, Id=f9912ddf-d1ef-4b5e-8d69-7359444a766c, Duration=6192ms)
[2024-04-07T11:11:32.680Z] System.Private.CoreLib: Exception while executing function: Functions.queueconsumer. Microsoft.Azure.Workflows.Web.Edge: The flow run '08584891185989659111249140401CU00' does not complete successfully. Run status: 'Failed'. Run error: 'An action failed. No dependent actions succeeded.'.
例如,使用消息 ID 属性时会发生相同的错误。
当我使用 Body 属性时,它可以工作,我收到的消息是:
[{"contentData":"test","userProperties":{"machineName":"xxxxxxxxx","userName":"xxxxx"},"messageId":"439de125-ec06-45c2-9bfa-14a377322cbf","label":"Service Bus Explorer","scheduledEnqueueTimeUtc":"1-1-1970 00:00:00","timeToLive":"14.00:00:00","deliveryCount":1,"enqueuedSequenceNumber":0,"enqueuedTimeUtc":"2024-04-07T11:02:37.774Z","lockedUntilUtc":"2024-04-07T11:03:50.4Z","lockToken":"3bb0c391-d873-4127-9e16-6d43e1aa1168","sequenceNumber":21}]
我尝试了一个表达式:json(triggerBody()?['contentData'])
但是,当我使用内容或消息 ID 属性时,会发生相同的错误。
您将在触发器中收到数组的消息。虽然
@triggerBody()?['contentData']
不起作用,但 @triggerBody()?[0]?['contentData']
可以 - 尽管它只会获取 first 消息的内容。
For each
操作并使用 @triggerBody()
作为输入。这将允许您独立处理数组中所有消息的内容:@items('For_each')?['ContentData']
。