In this example we want to start an Azure Logic Apps workflow on local XML data changes. Please copy your Layer2 Cloud Connector sample connection and adapt it as required.
Fig.: Layer2 Cloud Connector sample connection to adapt for evaluation.
Please configure your data source first. In this case the sample data source is a local XML file, but can be any supported data source. The Layer2 Data Provider for XML is used to query an XML file via XPath. Please note the primary key (column with unique values) in the result set. It is required for data sync. You can also make use of several columns that are unique together, e.g. Col1, Col2, Col3.
Fig.: Layer2 Cloud Connector sample data source (XML file)
Next let's configure the Azure Logic Apps data destination. Please select the Layer2 Data Provider for Azure Logic Apps for this. You will need a Web Hook Url for this (see below how to get it). Please also provide a symbolic SQL-like data query for data mapping and to declare data types, and a primary key. The SQL query is also used to generate and display a JSON schema of your data items required for the Azure Logic App.
You can use a notation similar to this:
Select ProductID: integer, ProductName, SupplierID:integer, UnitPrice:float
If you don't add any data type string is assumed by default. Please take a look into the User's Guide for more data types.
Fig.: Azure Logic Apps data destination configured in the Layer2 Cloud Connector.
Fig.: The Layer2 Cloud Connector provides the JSON schema of the data source as required in Azure Logic Apps to connect to the data source and map fields.
Fig.: make use of the data mapping section to map the data source columns (from XML) to the data destination (Azure Logic Apps) in this sample.
Next create your Azure Logic App as follows:
Fig.: Configure the Azure Logic Apps HTTP POST end-point.
You will find the web hook url in the definition of the HTTP Post. Also paste your JSON schema to the request body section. Now you are ready to add some specific logic. In this sample we will send an email notification via Azure Logic App if the number of units in stock is below the reorder level in the local data source.
Fig.: Apply a logical expression in Azure Logic Apps based on the changed local data record.
Fig.: Select the "Send an email" action from the actions offered by Azure Logic Apps.
You can configure the email based on the local data source record as provided by the Layer2 Cloud Connector.
Fig.: Sample email configuration to send notifications in Azure based on local data changes.
You are now ready to run your Layer2 Cloud Connector connection as usual, manually (using the Run Toolbox for testing), on-demand (using the command line) or scheduled (using the Windows service). If your condition is true, you will receive the following email from your connected Azure Logic App:
Fig.: Sample email, received from Azure Logic Apps if the condition is true on local data changes via the Layer2 Cloud Connector.
Please check your SPAM folder, if you don't receive emails as expected from Azure.