Skip to content

Commit dac0d9e

Browse files
committed
Edit content
1 parent 87c6524 commit dac0d9e

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

articles/logic-apps/logic-apps-scenario-function-sb-trigger.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,50 @@ ms.reviewer: estfan, azla
77
ms.topic: how-to
88
ms.date: 11/08/2019
99
ms.custom: devx-track-csharp
10+
#Customer intent: As a logic apps developer, I want to use Azure Logic Apps to respond automatically and instantaneously to Azure Service Bus messages so that I don't have to monitor the messages manually.
1011
---
1112

1213
# Call or trigger logic apps by using Azure Functions and Azure Service Bus
1314

1415
[!INCLUDE [logic-apps-sku-consumption](../../includes/logic-apps-sku-consumption.md)]
1516

16-
You can use [Azure Functions](../azure-functions/functions-overview.md) to trigger a logic app when you need to deploy a long-running listener or task. For example, you can create a function that listens in on an [Azure Service Bus](../service-bus-messaging/service-bus-messaging-overview.md) queue and immediately fires a logic app as a push trigger.
17+
You can use [Azure Functions](../azure-functions/functions-overview.md) to trigger a logic app workflow when you need to deploy a long-running listener or task. For example, you can create a function that listens in on an [Azure Service Bus](../service-bus-messaging/service-bus-messaging-overview.md) queue and immediately fires a logic app as a push trigger.
1718

1819
## Prerequisites
1920

20-
* An Azure subscription. If you don't have an Azure subscription, [sign up for a free Azure account](https://azure.microsoft.com/free/).
21+
* An Azure account and subscription. If you don't have a subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2122

2223
* An Azure Service Bus namespace. If you don't have a namespace, [create your namespace first](../service-bus-messaging/service-bus-create-namespace-portal.md).
2324

2425
* A function app, which is a container for your functions. If you don't have a function app, [create your function app first](../azure-functions/functions-get-started.md), and make sure that you select .NET as the runtime stack.
2526

26-
* Basic knowledge about [how to create logic apps](../logic-apps/quickstart-create-first-logic-app-workflow.md)
27+
* Basic knowledge about [how to create a Consumption logic app workflow](quickstart-create-first-logic-app-workflow.md) or [how to create a Standard logic app workflow](create-single-tenant-workflows-azure-portal.md).
2728

28-
## Create logic app
29+
## Create a logic app workflow
2930

30-
For this scenario, you have a function running each logic app that you want to trigger. First, create a logic app that starts with an HTTP request trigger. The function calls that endpoint whenever a queue message is received.
31+
For this scenario, you have a function running for each logic app that you want to trigger. First, create a logic app workflow that starts with an HTTP request trigger. The function calls that endpoint whenever a queue message is received.
3132

3233
1. Sign in to the [Azure portal](https://portal.azure.com), and create blank logic app.
3334

3435
If you're new to logic apps, review [Quickstart: Create your first logic app](../logic-apps/quickstart-create-first-logic-app-workflow.md).
3536

3637
1. In the search box, enter `http request`. From the triggers list, select the **When a HTTP request is received** trigger.
3738

38-
![Select trigger](./media/logic-apps-scenario-function-sb-trigger/when-http-request-received-trigger.png)
39+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/when-http-request-received-trigger.png" alt-text="Screenshot of the designer in the portal. The search box contains 'http request.' Under 'Triggers,' 'When a HTTP request is received' is highlighted.":::
3940

4041
With the Request trigger, you can optionally enter a JSON schema to use with the queue message. JSON schemas help the Logic App Designer understand the structure for the input data, and make the outputs easier for you to use in your workflow.
4142

4243
1. To specify a schema, enter the schema in the **Request Body JSON Schema** box, for example:
4344

44-
![Specify JSON schema](./media/logic-apps-scenario-function-sb-trigger/when-http-request-received-trigger-schema.png)
45+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/when-http-request-received-trigger-schema.png" alt-text="Screenshot of the details of an HTTP request trigger. Some JSON code is visible in the 'Request Body JSON Schema' box.":::
4546

4647
If you don't have a schema, but you have a sample payload in JSON format, you can generate a schema from that payload.
4748

4849
1. In the Request trigger, select **Use sample payload to generate schema**.
4950

5051
1. Under **Enter or paste a sample JSON payload**, enter your sample payload, and then select **Done**.
5152

52-
![Enter sample payload](./media/logic-apps-scenario-function-sb-trigger/enter-sample-payload.png)
53+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/enter-sample-payload.png" alt-text="Screenshot of the details of an HTTP request trigger. Under 'Enter or paste a sample JSON payload,' some payload data is visible.":::
5354

5455
This sample payload generates this schema that appears in the trigger:
5556

@@ -89,7 +90,7 @@ For this scenario, you have a function running each logic app that you want to t
8990

9091
The callback URL appears in the **HTTP POST URL** property.
9192

92-
![Generated callback URL for trigger](./media/logic-apps-scenario-function-sb-trigger/callback-URL-for-trigger.png)
93+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/callback-URL-for-trigger.png" alt-text="Screenshot of the details of an HTTP request trigger. Next to 'HTTP POST URL,' a URL is visible.":::
9394

9495
## Create a function
9596

@@ -99,17 +100,11 @@ Next, create the function that acts as the trigger and listens to the queue.
99100

100101
1. Under your function app name, expand **Functions**. On the **Functions** pane, select **New function**.
101102

102-
![Expand "Functions" and select "New function"](./media/logic-apps-scenario-function-sb-trigger/add-new-function-to-function-app.png)
103+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/add-new-function-to-function-app.png" alt-text="Screenshot of the 'Functions' page of a function app in the portal, with 'Create' highlighted. On the navigation menu, 'Functions' is highlighted.":::
103104

104-
1. Select this template based on whether you created a new function app where you selected .NET as the runtime stack, or you're using an existing function app.
105+
1. Select the **Azure Service Bus Queue trigger** template.
105106

106-
* For new function apps, select this template: **Service Bus Queue trigger**
107-
108-
![Select template for new function app](./media/logic-apps-scenario-function-sb-trigger/current-add-queue-trigger-template.png)
109-
110-
* For an existing function app, select this template: **Service Bus Queue trigger - C#**
111-
112-
![Select template for existing function app](./media/logic-apps-scenario-function-sb-trigger/legacy-add-queue-trigger-template.png)
107+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/current-add-queue-trigger-template.png" alt-text="Screenshot of the 'Create function' page of a function app in the portal. Under 'Template,' 'Azure Service Bus Queue trigger' is highlighted.":::
113108

114109
1. Under **Template details**, enter a name for your function, and set up the **Service Bus connection** for the queue, which uses the Azure Service Bus SDK `OnMessageReceive()` listener. Next, enter the queue name, and then select **Create**.
115110

@@ -142,9 +137,23 @@ Next, create the function that acts as the trigger and listens to the queue.
142137
}
143138
```
144139

145-
1. To test the function, add a queue message by using a tool such as the [Service Bus Explorer](https://github.com/paolosalvatori/ServiceBusExplorer).
140+
## Test your logic app workflow
141+
142+
1. To test your logic app workflow, use a tool to add a message to your Service Bus queue.
143+
144+
1. In the Azure portal, open your Service Bus namespace.
145+
146+
1. On the Service Bus namespace navigation menu, select **Queues**.
147+
148+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/service-bus-namespace-queues.png" alt-text="Screenshot of a Service Bus namespace in the Azure portal. On the navigation menu, 'Queues' is highlighted.":::
149+
150+
1. Select the queue that you linked to your function through its Service Bus connection.
151+
152+
1. On the queue navigation menu, select **Service Bus Explorer**, and then select **Send messages**.
153+
154+
:::image type="content" source="./media/logic-apps-scenario-function-sb-trigger/select-service-bus-explorer.png" alt-text="Screenshot of a Service Bus queue page in the portal, with 'Send message' highlighted. On the navigation menu, 'Service Bus Explorer' is highlighted.":::
146155

147-
The logic app triggers immediately after the function receives the message.
156+
1. Use the tool to send a message to your Service Bus queue. The message triggers your logic app.
148157

149158
## Next steps
150159

43.7 KB
Loading
40.4 KB
Loading

0 commit comments

Comments
 (0)