Microsoft Azure Logic Apps: Building a Logic App

This article is refered from TechNet Wiki and original article was written by Steef-Jan Wiggers.
Introduction

You can build integration solutions with BizTalk Server, a server product from Microsoft intended to provide large scale Enterprise Application Integration. The rise of the internet, mobile devices, Software as a Service, Internet of Things the demand for hybrid- and cloud integration becomes apparent. Therefore Microsoft has created services in Azure to provide you capabilities to build such solutions. The Service Bus has the capabilities to build brokered and direct messaging with queues, topics and subscriptions, and relays. Another service, BizTalk Services, was intended to build integration solution to bridge cloud with on premise Line-Of-Business systems. Going forward Microsoft has based on the BizTalk Services and Micro services paradigm build Apps service.
The App Service is a collection of web-, mobile, logic and API apps as depicted in the above diagram. And in this article we will go into building a simple Logic App. A Logic enables you to build an automated process across SaaS and on premise using a Browser. You log into Azure Portal, go to preview portal in case you land on the current portal. This is the starting point to create a Logic App. Note that the Logic App i.e. App Service is still in preview mode until later this year when it will become generally available.
Logic App Concepts
The Logic Apps with App Service are intended to build a business process i.e. workflow hosted in Microsoft Azure based on a price plan. Price plan is based on non-functional requirements. Functional requirements will drive the logic. Logic consists of triggers and actions. A Trigger based on an event will instantiate the workflow and actions are step(s) after the trigger. Some of the integration capabilities found on BizTalk Server like mapping, rules, validation and more can be found in Marketplace apps.
Sample scenario
In this article we are going to build a simple Logic App that runs every hour collect Tweets with a certain hashtag, and route them a Service Bus Queue named tweets.
Building a Logic App
Login into the Azure Portal and go to preview portal if necessary. In the above left corner you can click NEW and select Web + Mobile. Here you can find the Logic App. Click on it to create one.
Note that whenever you create a new API, App, Logic App, Web App or Mobile App, you need to specify the App Service Plan that provides the pricing container for your service. Once that’s done, you cannot alter it. When you click on Logic App a new pane will appear, where you specify a name for you Logic App.
Once you click create a Logic App will be provisioned for you. It is an empty container with no logic with some default settings i.e. Pricing Tier, Resource Group, Subscription, Location and Logic (triggers and actions). The settings cannot be altered except for the logic i.e. trigger and action. As soon as your Logic App is provisioned, you can start creating some logic for it by dragging and dropping triggers and actions. You click triggers and actions in your Logic App and a design pane will appear in your browser.
At the right side of the pane shapes can be found to function as a trigger and subsequent actions. The shapes are from API Apps Library. For this scenario a Recurrence shape (trigger) and two subsequent shapes (actions) have placed on the canvas.
Based on price plan you can specify the recurrence of the Logic App. Free price plan means the Frequency cannot be under 1 hour. Once you click Twitter Connector you will have to authorize to have access to a twitter account (OAuth on the background taking care of this). Subsequently, you can specify what the connector has to do. In this case look for tweet text with a certain hashtag.
Next action following the Twitter Connector will be the Azure Service Bus Connector. You need to provide the connection string for the Service Bus i.e. namespace. Subsequently you can specify what this connector needs to perform. Sending a message i.e. the body of the tweet to the specified queue.
In the design pane, you can click to code view to see the JSON belonging to the specified logic. This will give the ability to store the logic in case you like to reuse it.
Logic App in action
The Logic App runs every hour and collects the tweets containing the specified hashtag and sends these to Service Bus Queue.
By connecting to the Service Bus Queue using the Service Bus Explorer the Tweets can be viewed.
In the browser the trigger history of the Logic App can be inspected.  In case a run has not succeeded you can click on the failed run. Navigate to failed step and click on the in- or output link.
By clicking one of the operations the actions in the Logic App can be inspected.
The output can be analyzed to troubleshoot the error.
Wrap up
The Logic App is part of the App Service and currently in preview. This means it is still in the early stages and you experience bugs or awkward behavior. However, do not be discouraged as bug fixes as done every day based on feedback from users. The Logic App will improve every day and you can expect:
  • Convoys, Long running process, Auto Delivery
  • Large Message handling
  • Azure services available on premise (Azure Pack)
  • Built-in designer for Logic App in Visual Studio
  • Better error messages

Leave a Reply

Your email address will not be published. Required fields are marked *