Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each_message_in_batch": {
"actions": {
"Parse_message": {
"description": "Parse each individual record",
"inputs": {
"content": "@items('For_each_message_in_batch')",
"schema": {
"properties": {
"email": {
"type": "string"
},
"familyName": {
"type": "string"
},
"givenName": {
"type": "string"
},
"id": {
"type": "integer"
},
"phoneNumber": {
"type": "string"
},
"role": {
"type": "string"
},
"timestamp": {
"type": "string"
},
"userName": {
"type": "string"
}
},
"type": "object"
}
},
"runAfter": {},
"type": "ParseJson"
},
"Send_message": {
"inputs": {
"body": {
"ContentData": "@{base64(body('Parse_message'))}",
"ContentType": "application/json",
"MessageId": "@{body('Parse_Request_Payload')?['id']}|@{body('Parse_message')?['id']}",
"Properties": {
"BatchId": "@{body('Parse_Request_Payload')?['id']}",
"ClientTrackingId": "@{body('Parse_message')?['email']}",
"CorrelationWorkflowRunId": "@{workflow()?['run']?['name']}",
"EntityId": "@{body('Parse_message')?['id']}"
}
},
"host": {
"connection": {
"referenceName": "servicebus"
}
},
"method": "post",
"parameters": {
"entityName": "user-updated",
"message": {
"UserProperties": {
"ClientTrackingId": "@body('Parse_message')?['email']",
"CorrelationWorkflowRunId": "@workflow()?['run']?['name']",
"EntityId": "@body('Parse_Request_Payload')['id']"
},
"contentData": "@items('For_each_message_in_batch')",
"contentType": "application/json",
"correlationId": "@workflow()?['run']?['name']",
"messageId": "@{body('Parse_Request_Payload')?['id']}|@{body('Parse_message')?['id']}"
}
},
"path": "/@{encodeURIComponent(encodeURIComponent('user-updated'))}/messages",
"queries": {
"systemProperties": "None"
},
"serviceProviderConfiguration": {
"connectionName": "serviceBus",
"operationId": "sendMessage",
"serviceProviderId": "/serviceProviders/serviceBus"
}
},
"runAfter": {
"Parse_message": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"foreach": "@body('Parse_Request_Payload')?['data']",
"runAfter": {
"Parse_Request_Payload": [
"Succeeded"
]
},
"type": "Foreach"
},
"Parse_Request_Payload": {
"inputs": {
"content": "@triggerBody()",
"schema": {
"properties": {
"data": {
"items": {
"properties": {
"email": {
"type": "string"
},
"familyName": {
"type": "string"
},
"givenName": {
"type": "string"
},
"id": {
"type": "integer"
},
"phoneNumber": {
"type": "string"
},
"role": {
"type": "string"
},
"timestamp": {
"type": "string"
},
"userName": {
"type": "string"
}
},
"required": [
"id",
"userName",
"email",
"role",
"givenName",
"familyName",
"phoneNumber",
"timestamp"
],
"type": "object"
},
"minItems": 1,
"type": "array"
},
"datacontenttype": {
"type": "string"
},
"id": {
"type": "string"
},
"source": {
"type": "string"
},
"specversion": {
"type": "string"
},
"subject": {},
"time": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"data",
"datacontenttype",
"id",
"source",
"specversion",
"time",
"type"
],
"type": "object"
}
},
"runAfter": {
"Trace_workflow_metadata": [
"Succeeded"
]
},
"type": "ParseJson"
},
"Return_202_response": {
"inputs": {
"body": {
"ActivityId": "@{workflow().run.name}",
"Message": "Accepted",
"StatusCode": 202
},
"statusCode": 202
},
"kind": "http",
"runAfter": {
"For_each_message_in_batch": [
"Succeeded"
]
},
"type": "Response"
},
"Return_400_BadRequest_response": {
"inputs": {
"body": {
"ActivityId": "@{workflow().run.name}",
"Message": "Bad request. Invalid message.",
"StatusCode": 400
},
"statusCode": 400
},
"kind": "http",
"runAfter": {
"Parse_Request_Payload": [
"Failed"
]
},
"type": "Response"
},
"Return_500_response": {
"inputs": {
"body": {
"ActivityId": "@{workflow().run.name}",
"Message": "Internal Server Error",
"StatusCode": 500
},
"statusCode": 500
},
"kind": "http",
"runAfter": {
"For_each_message_in_batch": [
"FAILED",
"TIMEDOUT"
]
},
"type": "Response"
},
"Terminate_as_Failed_(PublisherDeliveryFailed_InternalException)": {
"inputs": {
"runError": {
"code": "PublisherDeliveryFailed_InternalException",
"message": "An exception occurred while processing the message for publishing."
},
"runStatus": "Failed"
},
"runAfter": {
"Return_500_response": [
"Succeeded"
]
},
"type": "Terminate"
},
"Terminate_as_Failed_(PublisherReceiptFailed_InvalidMessage)": {
"inputs": {
"runError": {
"code": "PublisherReceiptFailed_InvalidMessage",
"message": "An exception occurred while receiving a message in publisher endpoint due to an invalid HTTP request. "
},
"runStatus": "Failed"
},
"runAfter": {
"Return_400_BadRequest_response": [
"Succeeded"
]
},
"type": "Terminate"
},
"Trace_workflow_metadata": {
"inputs": {
"InterfaceId": "USER.SVC01.P01v1"
},
"runAfter": {},
"trackedProperties": {
"InterfaceId": "@{outputs('Trace_workflow_metadata')?['InterfaceId']}"
},
"type": "Compose"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"manual": {
"correlation": {
"clientTrackingId": "@{coalesce(triggerBody()?['id'], guid())}"
},
"inputs": {},
"kind": "Http",
"type": "Request"
}
}
},
"kind": "Stateful"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment