View
468
Download
0
Category
Tags:
Preview:
Citation preview
tSponsors
Stephen SicilianoSenior Program Manager, Microsoft
Inside Logic Apps
BizTalk Summit 2015 – LondonExCeL London | April 13th & 14th
AgendaIntroduction
Background
Basic scenario – WebHook initiated Logic App
Taking it to the next level
Repeats
Conditionals
Parameters
API APPS
Easily build and consume APIs in the cloud
WEB APPSWeb apps that scale with your
business
LOGIC APPS
Automate business process across SaaS and on-premises
MOBILE APPS
Build Mobile apps for any device
App Service
Azure Resource ManagerThe Azure Resource manager is a highly-scalable geo-distributed system that handles millions of resources across 100,000’s of subscriptions.
Same underlying engine…
RESOURCE MANAGER
Can handle thousands of parallel deployments per stamp
Resilient against failure – retries with “at least once” guarantee
Simple, declarative JSON template
Automatically infers dependences between resources
LOGIC APPS
Can handle thousands of parallel runs per stamp
Resilient against failure – retries with “at least once” guarantee
Simple, declarative JSON definition
Automatically infers dependences between actions
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-
preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": { "myWorkerSize": 0 },
"parameters": {
"siteName": { "type": "string" },
"hostingPlanName": { "type": "string" },
"siteLocation": { "type": "string" },
"sku": {
"type": "string",
"allowedValues": [ "Free", "Shared", "Basic", "Standard" ],
"defaultValue": "Free"
},
"workerSize": {
"type": "string",
"allowedValues": [ "0", "1", "2" ],
"defaultValue": "0"
}
},
"resources": [ {
"name": "myplan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2014-04-01-preview",
"location": "West US",
"tags": { "dept": "test" },
"properties": {
"Name": "myplan1",
"sku": "Free",
"workerSize": "[variables('myWorkerSize')]",
"numberOfWorkers": 1
}
},
{
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2014-04-01-preview",
"location": "[parameters('siteLocation')]",
"tags": {
"[concat('hidden-related:', resourceGroup().id,
'/providers/Microsoft.Web/serverfarms/',
parameters('hostingPlanName'))]": "Resource"
{
"$schema":
"http://schema.management.azure.com/providers/Microsoft.Logic/schemas/2014-12-01-
preview/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"keyword": {
"defaultValue": "logicapps",
"type": "string"
}
},
"triggers": {
"twitterconnector": {
"recurrence": {
"frequency": "Hour",
"interval": 1
},
"type": "ApiApp",
"inputs": {
"apiVersion": "2015-01-14",
"host": {
"id": "/subscriptions/423db32d-4f58-4220-961c-
b59f14c962f1/resourcegroups/bpmdemo003/providers/Microsoft.AppService/apiapps/twitte
rconnector",
"gateway":
"https://bpmdemo003423db32d4f584220961cb59f14c962f1.azurewebsites.net"
},
"operation": "TriggerOnNewTweet",
"parameters": {
"triggerId": "@workflow().name",
"parameters": {
"callbackUrl":
"@accessKeys('default').primary.secretRunUri",
"inputs": {
"Keywords": "@parameters('keyword')"
}
}
},
"authentication": {
"type": "Raw",
"scheme": "Zumo",
"parameter":
… more power
RESOURCE MANAGER
8 functions for basic referencing and string functions
Can only PUT resources into resource groups
Auth must be through AAD
Triggered manual through API
LOGIC APPS
Over 50 functions from string manipulations to math, to sets operations, to logical operators
All HTTP operations supported on any arbitrary endpoint
Supports many OAuth providers, AAD, Cert auth, or Basic auth
4 different ways to be triggered
User adds an item to a list in their
Mobile app
Mobile app has the callback URI for the workflow
When the callback URI is called, the
workflow immediately starts the “first*” action
All dependent actions in the
workflow continue as normal
Actions with simple orchestration3 ways to introduce dependences between
actions:
1. Implicitly – whenever you reference the output of an action you’ll depend on that action executing first
2. Explicit “dependsOn” condition – you can mark certain actions to run only after previous ones have completed“dependsOn” : “twitterconnector”
3. Explicit “expression” condition – a complex function that evaluates properties of other actions“expression” : “@equals(actions(‘twitterconnector’).code, ‘InternalServerError’)”
Triggering a Logic app “Run”Recurring schedule – “every X hours”
Polling an API for a responseA 200 response means “run” -- a 202 response means “wait”Can use trigger state to get information on the previous execution
Registering an API App to “push” to a workflowUsing a custom contract implemented for API Apps
WebHookEvery workflow has an endpoint you can POST to from any web serviceSupports Basic auth for simple systems
ManuallyUser can click the “Run Now” button in the portal
RepeatingLoop a single action over a list of items
Runs the action N times
You can get at all of the statuses for each action
Tip: when you have multiple collections use:
"repeat" : "@range(0,length(body('connector1')))"
…
"inputs" : "@concat(body('connector1')[repeatItem()],body('connector2')[repeatItem()])"
ConditionalsLogic on a trigger or action
For triggers conditionals are post-conditions
For actions conditionals are pre-conditions
You can do conditionals inside of repeats to perform as a filter
Parameters
Dev Workflow Prod Workflow
Definition
Declares
parameters
Uri: @parameters
(‘endpoint’)
Definition
(identical)
Declares same
parameters
Uri: @parameters
(‘endpoint’)
Parameters
Provides DEV
config
Endpoint :
“http://int.mysite.n
et”
Parameters
Provides PROD
config
Endpoint :
“http://mysite.net”
• Re-using values, or even complex objects, throughout the definition, which makes it
easier to comprehend
• Separate out config from the definition itself, making sharing easy, as well as across
different environments.
MessagesLarge message support is built-in (<100 MB)
To handle binary blobs of data you can:
1. Externalize state (save it to Azure storage)
2. Base64 encode it and return it directly in the workflow (workflows are JSON)
All messages are archived
Retention period depends on the App Service plan
Debugging tipsTry calling the API App directly:
POST {gatewayURI}/api/service/invoke/{api app name}/{operation name}?api-version=2015-01-14
x-zumo-auth : {your token}
This may be a faster way to iterate if you are seeing failures
Use requestb.in to debug triggers – you can inspect all incoming requests
Enable logging for the Web app hosting the API App
*New* you can Cancel a Run if it is failed
Recommended