Use workflows to orchestrate flow services across runtimes with webMethods.io Integration
products: webMethods.io Integration
Introduction
webMethods.io Integration workflows can seamlessly execute flow services across your hybrid integration landscape. In this how-to, learn how to use webMethods.io workflows to orchestrate flow services across edge runtimes from one centralized control plane.
This is the sixth part of a series of webMethods.io Integration tutorials exploring the platform’s Super iPaaS Develop anywhere, deploy anywhere capabilities. If you missed the previous part, you can find it here: Create and develop flow services to run on the Cloud Runtime with webMethods.io Integration.
Prefer watching a video? See our Developer Evangelist Theo Ezell walk through the steps in this video tutorial:
![:film_projector:](https://emoji.discourse-cdn.com/twitter/film_projector.png?v=12 ":film_projector:") Use workflows to orchestrate flow services across runtimes with webMethods.io Integration
Pre-requisite
A webMethods.io Integration environment.
Note: These capabilities are not available by default. Contact your sales representative for more information.
Let’s begin
For the purposes of this tutorial, we will use two Flow services created in the same project in a webMethods.io Integration environment.
The first Flow service getEmployeeById uses a JDBC Adapter to retrieve an employee record from a database and run on a remote Edge Runtime.
On the other hand, the isInteger service runs on the default Cloud Runtime and validates if an input string is an integer or not. If you need a refresher on how to create Flow services that run on the default Cloud Runtime, please refer to Create and develop flow services to run on the Cloud Runtime with webMethods.io Integration.
The workflow we will create executes both services and sends an alert email in case of failure.
[](https://global.discourse-cdn.com/techcommunity/original/3X/a/c/ac82a393932b1be7a4728286eef4ddb1b917d5b5.jpeg "Flow services tab")
Navigate to the Workflows tab and click the plus icon to create a new one:
[](https://global.discourse-cdn.com/techcommunity/original/3X/b/6/b697b6e12ad01d2432c1a8da2079429a77120bee.jpeg "Create new workflow")
Choose the option to create the workflow from scratch:
[](https://global.discourse-cdn.com/techcommunity/original/3X/2/3/23a8d42310a7aaa392d88e4afbc8cb2587dbf0f7.jpeg "Workflow from sratch")
Type a workflow name, for example getEmployee and click Done:
[](https://global.discourse-cdn.com/techcommunity/original/3X/6/0/603cfdd07dfabf8a5699934fb235889235669a74.jpeg "Name the workflow")
Set up a trigger action
Click the gear icon of the start step, this will open the triggers list. Since this workflow will be called by a webhook, choose the Webhook trigger:
[](https://global.discourse-cdn.com/techcommunity/original/3X/e/8/e85ce4b6b0ffdc7d2dee1d37170437af8bf341ca.jpeg "Webhook trigger")
Clicking Next leads to the Configure webhook payload data which will be used as sample data to configure the rest of the workflow:
[](https://global.discourse-cdn.com/techcommunity/original/3X/2/b/2b1efae126f4bd43be6c094db7a3ed5653716de3.jpeg "Webhook configuration")
Copy the test webhook URL and paste it into an API platform for building and using APIs, for example Postman. Make sure to provide the sample data in a JSON format in the API request body – in our case the Employee ID {“employeeId”:”7”}
and send it:
[](https://global.discourse-cdn.com/techcommunity/original/3X/7/e/7ee61eceb227a78f484c942c2897a0a31882e540.jpeg "Run sample data")
Go back to the webhook configuration in the webMethods.io Integration environment and click Fetch to retrieve the data:
[](https://global.discourse-cdn.com/techcommunity/original/3X/1/8/1882911ea218cb6267210aee92f62bae3a4c060e.jpeg "Fetch sample data")
You should see the fetched Headers and Body data. Click Next.
The next step is to choose an authentication method for your API request. In our case, we will use a webhook key – enable the webhook key button, click Generate token and copy it.
[](https://global.discourse-cdn.com/techcommunity/original/3X/9/1/91942c3e081b29fa64f9c608c3caeb8e97e83978.jpeg "Authentication method")
Clicking Next will generate your webhook URL. Copy it and paste it into Postman.
[](https://global.discourse-cdn.com/techcommunity/original/3X/3/6/36b518082119514ab63ea9065d964fdcb2ba30da.jpeg "Webhook URL")
Under the Headers tab, add a webhook_key key and paste your webhook key generated earlier as value:
[](https://global.discourse-cdn.com/techcommunity/original/3X/9/d/9d7cf1005ea0e6ff3264dd336e26aec41edbcd25.jpeg "API endpoint and webhook key")
Configure the execution of a Flow service
Let’s move on to the next step of the workflow. Navigate to the Flow services tab on the Connectors list and drag and drop the isInteger Flow service to the canvas. This should automatically connect it to the trigger step:
[](https://global.discourse-cdn.com/techcommunity/original/3X/a/1/a1e92f78f2c8b34627e0cdc63f46b9463aa26446.png "Add Flow service")
Click the gear icon to configure it. Since it is a Flow Anywhere service, you should select the Runtime on which the service will run. In this case, this will be the Default Cloud runtime:
[](https://global.discourse-cdn.com/techcommunity/original/3X/a/8/a807531814ca98da55881d68655f74e3005a4840.jpeg "Configure isInteger")
Click Next. Now map the employeeID string received from the webhook trigger to the inString string and click Next again:
[](https://global.discourse-cdn.com/techcommunity/original/3X/c/4/c4f9e74fe8661f3da204ebd53ed867d5ba427869.jpeg "Configure isInteger 2")
Then click on Test to capture the output data and Done.
Set up Switch cases
Next, we will use the Switch tool to perform a check whether the isInteger service returns true or false. Navigate to the Utility tab on the Connectors list, search for the Switch tool under the Developers tools, and drag and drop it to the canvas. This should automatically connect it to the previous step.
To set the first Switch case, drag and drop to the canvas the getEmployeeById Flow service:
[](https://global.discourse-cdn.com/techcommunity/original/3X/9/3/9332210e891b539a6d888c94177694dbe5b32021.jpeg "Switch case 1")
Click the gear icon on the Case 1 arrow, add condition and check if the isInteger output matches true:
[](https://global.discourse-cdn.com/techcommunity/original/3X/9/f/9fe198e8368b5037ec5f98fd73699ede770bd2e6.jpeg "Configure case 1")
Now continue with the configuration of the getEmployeeById Flow service by clicking its gear icon. This service will run on a remote Edge Runtime – search it in the dropdown menu and click Next:
[](https://global.discourse-cdn.com/techcommunity/original/3X/8/7/8721147dd3b45fed20600155e29a068af6a451ac.png "Configure getEmployeeById")
Map the employeeId string with the employeeId webhook output string, Click Next, then Test and Done.
[](https://global.discourse-cdn.com/techcommunity/original/3X/b/5/b56a160759ae1762accd1b0bc859971982a96e2d.jpeg "Configure getEmployeeById 2")
For the second Switch case or the Error case, drag and drop close to the Switch tool the Gmail connector:
[](https://global.discourse-cdn.com/techcommunity/original/3X/2/6/2633b3c861638eb8102906669a0fa91748807d3e.jpeg "Switch case 2")
Click the gear icon on the Case 2 arrow, add a condition, and check if the isInteger output matches false:
[](https://global.discourse-cdn.com/techcommunity/original/3X/7/2/720a617fc233b8537c1ca1bf422ff4ae85dd3fcf.jpeg "Configure case 2")
Now continue with the configuration of the Gmail connector by clicking its gear icon. Select Send an Email as action, connect your Gmail account with webMethods.io Integration, and click Next:
[](https://global.discourse-cdn.com/techcommunity/original/3X/8/0/805caca0063e31189b45f3b6b86893d1d22c3828.png "Configure Gmail action")
Fill out the To field with the email address/es that you want to send this email to, type a Subject line and an Email body content:
[](https://global.discourse-cdn.com/techcommunity/original/3X/6/2/62e774ad2b77d8ff76ebbb68c1ca228a800eaf2d.jpeg "Configure Gmail connector")
Return data step configuration
The last step is to return the API request results. Add to the canvas the Return Data on Sync Webhook tool next to the getEmployeeById Flow service. Click the gear icon and set the positive response data, for example the employeeId and lastName strings:
[](https://global.discourse-cdn.com/techcommunity/original/3X/1/3/13ac939d2f9f068e7fc5461753e1c04ac488c761.jpeg "Configure Return Data on Sync 1")
Add one more Return Data on Sync Webhook tool, this time next to the Gmail connector. Click the gear icon, set the Error message as well as set the status code to 500:
[](https://global.discourse-cdn.com/techcommunity/original/3X/2/0/20e7f4c7cd146c2cb54aa6ccd1c607e3df57378e.jpeg "Configure Return Data on Sync 2")
Connect the two Return Data on Sync Webhook steps to the end and save your workflow:
[](https://global.discourse-cdn.com/techcommunity/original/3X/9/0/9016bd7908e7ced9658a1f5b90719c0d25ea170c.jpeg "Final workflow")
Test the workflow
Now, we are ready to test the workflow. First with valid data – go to your API test platform, type a valid employee ID, for example 9 and click Send:
[](https://global.discourse-cdn.com/techcommunity/original/3X/4/c/4c7ec0680c17682b46c4fd30ba03e703d9b64cfc.jpeg "Test with valid data")
This will fetch the last name of the employee with ID 9.
For the second case, type an invalid employee ID, for example 9.2 and you should receive a 500 Internal Server Error with your Error message as well as receive an email with the invalid data:
[](https://global.discourse-cdn.com/techcommunity/original/3X/f/7/f75d0b088a5963a71cafe84d66caa3a391a378d6.jpeg "Test with invalid data")
What to do next
Now, you’ve seen how to use a workflow to execute Flow services across multiple Runtimes in your webMethods.io environment. Next, learn how to:
Export and import Flow services with webMethods.io Integration
Useful links | Relevant resources
- Use workflows to orchestrate flow services across runtimes with webMethods.io Integration
- What is Develop Anywhere, Deploy Anywhere? - Knowledge base / Blog - webMethods - Software AG Tech Community & Forums
- Create and develop flow services to run on the Cloud Runtime with webMethods.io Integration
- Create and manage your webMethods.io Integration projects
- Register New Edge Runtime with webMethods.io Integration
- Monitor your integration runtimes remotely with webMethods.io Integration.
- Edge Runtime Management with webMethods.io Integration
Subscribe to my newsletter
Read articles from TECHcommunity_SAG directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
TECHcommunity_SAG
TECHcommunity_SAG
Discover, Share, and Collaborate with the Software AG Tech Community The Software AG Tech Community is your single best source for expert insights, getting the latest product updates, demos, trial downloads, documentation, code samples, videos and topical articles. But even more important, this community is tailored to meet your needs to improve productivity, accelerate development, solve problems, and achieve your goals. Join our dynamic group of users who rely on Software AG solutions every day, follow the link or you can even sign up and get access to Software AG's Developer Community. Thanks for stopping by, we hope to meet you soon.