Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Robust Cloud Integration with Azure

You're reading from  Robust Cloud Integration with Azure

Product type Book
Published in Mar 2017
Publisher Packt
ISBN-13 9781786465573
Pages 696 pages
Edition 1st Edition
Languages
Authors (6):
Gyanendra Kumar Gautam Gyanendra Kumar Gautam
Ashish Bhambhani Ashish Bhambhani
Profile icon Ashish Bhambhani
Abhishek Kumar Abhishek Kumar
Profile icon Abhishek Kumar
James Corbould James Corbould
Profile icon James Corbould
Mahindra Morar Mahindra Morar
Profile icon Mahindra Morar
Martin Abbott Martin Abbott
Profile icon Martin Abbott
View More author details

Table of Contents (23) Chapters

Robust Cloud Integration with Azure
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. An Introduction to Systems Integration in the Cloud 2. What Is an Azure App Service? 3. Getting Started with API Apps 4. What is Azure API Management? 5. Trigger Your First Logic App in Azure 6. Working with Connectors in Logic Apps 7. Azure Functions in Logic Apps 8. A Deep Dive into Logic Apps 9. Powerful Integration with SaaS Using Logic Apps 10. Advanced Integration with Powerful, Scalable Service Bus in the Cloud 11. Connecting to Event Hubs and an Introduction to IoT Hubs 12. EAI/B2B Integration Using Logic Apps 13. Hybrid Integration Using BizTalk Server 2016 and Logic Apps 14. Tooling and Monitoring for Logic Apps 15. Whats Next for Azure Integration?

Chapter 6. Working with Connectors in Logic Apps

 

Insufficient facts always invite danger.

 
 --Mr. Spock, Star Trek

Azure Logic Apps is a cloud-based service that you can use to create workflows that run in the cloud. It provides a way to connect your applications, data, and SaaS application using a rich set of connectors. Connectors get data in and out of a Logic App. It is created specifically to help you when you are connecting to different data source or applications and working with your data.

In this chapter, you will learn the following topics:

  • What are the different types of connector available in Logic Apps?

  • What are Workflow Triggers and Actions?

  • How can we create our own custom connector?

Traditionally, the two of mainstream integration scenarios are as follows:

  • EAI (Enterprise Application Integration)

  • B2B (Business-to-Business) integration using EDI protocols, such as EDIFACT or ANSI X12

However, in today's world, many systems and users need to integrate with SaaS-based systems and API...

Categorizing Microsoft connectors


Connectors can be categorized into several groups based on the kind of operation they perform. These groups primarily include standard connectors and enterprise integration connectors.

Standard connectors

Standard connectors are the connectors created by Microsoft to work with SaaS applications or network services, and they include Office 365, SharePoint, Service Bus, Salesforce, SFTP, FTP/FTPS, and many more.

The following are the current list of available connectors created by Microsoft that are available as standard connectors. 

This list will keep growing. Please refer to the link: https://azure.microsoft.com/en-us/documentation/articles/apis-list/ for the latest list of standard connectors.

Some of these managed APIs can be used as is, such as Bing Translator, whereas others require configuration. This configuration is named a connection.

For example, when you use Office 365 connector, you need to create a connection that contains your sign-in token....

Types of triggers


The following six types of triggers are supported in Logic Apps as of now:

  • Recurrence trigger:This fires based on a defined recurring schedule—"every X second/minutes/hour/day".

  • HTTP  trigger: This polls an HTTP web endpoint for a response. Here, the connector as a trigger will either return 200 or 202 response.

    • A 200 response means "Run"—workflow will be executed

    • A 202 response means "Wait"—do not start the workflow as the connector does not have any response data to pass over to workflow

  • ApiConnection trigger: These are polls such as the HTTP trigger. However, it takes advantage of the Microsoft managed APIs (For more information refer to: https://azure.microsoft.com/documentation/articles/apis-list/). The basic functionality of API connection trigger is similar to the HTTP trigger.Here is an example of the Dropbox connector that polls a defined folder for a new file.

  • Manual trigger: This trigger serves as an endpoint that you call manually to invoke your Logic App...

Connector as an action


Each step after the trigger in a workflow is an action. Connectors can also be used as actions within your Logic Apps. Each action typically maps to an operation on your connector or custom API Apps that are defined in the Swagger metadata. Actions can have dependency, and they can be executed based on the condition such as success or failure of the previous action.

You can use the action for variety of operations such as to look up customer data from a SQL database when processing an order or may be to write, update, or delete data in a destination table.

Actions can be categorized as Standard Action and Collection Action.

Standard Actions:

There are six valid types of standard actions, each with unique behavior.

  • HTTP: This action calls an HTTP web endpoint.

  • ApiConnection: This action has behavior similar to the HTTP action; however, it takes advantage of the Microsoft-managed APIs. Here is a Dropbox action to create a file in the specified folder.

  • ApiConnectionWebhook...

Building your first connector


As discussed in the beginning of this chapter, a connector is basically an API app that focuses on connectivity and gets data in and out of Logic Apps. In this section, we will try to build an Azure Storage Table connector. At the time of writing this chapter, Azure Storage Table connector was not available in the marketplace.

Azure Storage Table connector

We are building this connector to pull author or chapter details for this book from a Book Entity in the storage table.

First of all, we will create the API App project for storage table connector. Please follow the steps described to create an API App in Chapter 3Getting Started with API Apps.

API App project will have a BookEntity model and a controller BookController as shown here:

BookController will have an operation GetBookEntity. This operation primarily takes the PartitionKey and the RowKey to fetch the record from the storage table. If you see the model, the author or the chapter is the partition...

Make your connector work for Logic Apps


Now when we try to use this API App as a custom connector in Logic Apps, there are certain gaps that we will cover now. First of all, we need to enable the CORS setting for the API App (AzureStorageTableConnector) we have created. Add a CORS policy for * to allow the requests from the Logic Apps Designer. Please refer to Chapter 3, Getting Started with API Apps, for understanding CORS.

We have created an empty Logic App in the portal where we select the custom connector – AzureStorageTableConnector. Once you have enabled the CORS, you would be able to see the AzureStorageTableConnector in custom connector list in Logics App.

Once you select the AzureStorageTableConnector in the Logic App, you can see the get operation with input parameters AUTHORORCHAPTER and SEQUENCENUMBER as shown later. And if you select the next connector in the Logic App (for example, I have selected the Dropbox connector), it shows all the outputs from the GetBookEntity operation...

Adding summary and XML Documentation


First, we need to turn on the generation of XML documentation in the Build properties page of API App project.

Now uncomment the line that tells Swasbuckle to include XML comments in the Swagger.cs file.

You now need to implement the function GetXMLCommentsPath() that would return the XMLComment file for the API.

Now if you run the project, you can see the following in the Swagger UI. Now you can see the summary for API and description for parameters as shown here:

Discovering partion keys in the storage table


One more thing if you note here is that when we use the AzureStorageTableConnector, it asks us for the partion key that can have only two values in our scenario, either author or chapter. It would be nice if our custom connector can go to storage table and find all the partion keys available and then may be provide it as a drop-down so that we can select the partion key instead of entering the value. This can be done using dynamic Swagger to enhance user experience. Swagger dynamically generates metadata depending on API App configuration.

To do this, you need to add a filter, as follows:

In the filter implementation, it looks for the parameter authorOrChapter , and if it finds the parameter, it will add it as an enumeration, which means the authorOrChapter parameter can take all the partition keys (author and chapter) as the enumeration value. To add the partition keys to enum, we have the method GetPartionKeys that abstracts how you get all...

Summary


In this chapter, we discussed about the Logic App Connectors, which are basically API Apps that focus on connectivity. We looked into different types of connector currently available in Logic Apps to build your business process workflows.

We also discussed about triggers and actions and their different types. Finally, we created custom connector to pull records from the Azure Storage Table. We used the custom connector to create a Logic App workflow, which can be invoked using an endpoint. We tested the Logic App using the tool Postman.

In the next chapter, we will understand Azure function and how it can be used in Logic Apps.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Robust Cloud Integration with Azure
Published in: Mar 2017 Publisher: Packt ISBN-13: 9781786465573
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}