Create and develop Flow services to run on the Cloud Runtime with webMethods.io Integration

Create and develop Flow services to run on the Cloud Runtime with webMethods.io Integration

products: webMethods.io Integration

Introduction

Setting up Flow services in the cloud runtime lets you take advantage of the scalability and flexibility of the cloud, making your organization more agile when facing changing workloads and varying data volumes. In this tutorial, learn how to create and run a simple Flow service in the cloud.

This is the fifth 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 manage your webMethods.io Integration projects.

Prefer watching a video? See our Developer Evangelist Theo Ezell walk through the steps in this video tutorial:
Create and develop Flow services to run on Cloud Runtime

Pre-requisite

A webMethods.io Integration environment.

Note: These capabilities are not available by default. Contact your sales representative for more information.

Steps to follow

For the purposes of this how-to, we are going to create a Flow service that validates if an input string contains an integer value.

Log in to your webMethods.io Integration environment and navigate to the Projects tab. Since every Flow service needs to be in a project, create a new one or open an existing one:

Flow services tab

Navigate to the Flow services tab on the left and click the plus sign to add a new Flow service:

Create new Flow services

Flow service settings

First, it is important to choose a runtime on which the Flow service will run. In this example, we will set the service as Flow anywhere to run on the Cloud Runtime:

Select Edge Runtime

Then, give your Flow service a name (for example, isInteger) and save it:

Name your Flow services

Next, open the I/O tab to define the input and output signature:

Input/output tab

In the Input Fields tab, type a name (inString) and choose String as type:

Define input

In the Output Fields tab, type again a name (isInteger) and in the Pick list specify the value to be true or false and click Done:

Define output

Data pick list

Flow service steps

  1. Start with the Transform pipeline step to set the default output to false. Click on the first step box and choose Transform pipeline from the dropdown menu. Then click on the View/Edit Pipeline button on the right: Transform pipeline From the View/Edit Pipeline wizard, click on the isInteger Pipeline output string and set the value to false. Click Save and close the edit wizard. Set output value
  2. Add a second step to your Flow service – the built-in isNumber service. This service will let you know if your string has a numeric value. isNumber service
  3. However, the isNumber service will also return true if the input string has a decimal point. That is why we need to do an additional check for a decimal point. For this purpose, as a third step of your flow service, add an If block – isNumber equal to true: If block
  4. If it is true, with the help of IndexOf service will check for a decimal point. In the Yes box, choose from the dropdown menu the IndexOf service: indexOf service Click on the View/Edit Pipeline option: View/Edit indexOf service Click on the subString under the Input – IndexOf column and set the value to “.”. Click Save and close the View/Edit wizard. Set input value
  5. Now add an additional step under the IndexOf service to check if the value return from the IndexOf service is equal to “-1”. That means that a decimal point is not found in the string: If block 2
  6. In this case, we can add a Transform Pipeline step and set the isInteger Pipeline output string to true: Transform pipeline 2 Set isInteger output value
  7. Especially during development, it’s handy to log input and output values to make sure your code behaves as expected. That is why as a next step we will add the built-in debugLog service. This service is just like the one on the on-prem Integration Server, so you might recognize it from there. debugLog service Click the View/Edit button and open the Input - debugLog message string. Enable Perform variable substitution and type a message: Set debugLog message Use the following button to search for substitution variables: Substitution variables dropdown Click Save and exit the View/Edit window.
  8. Lastly, add one more Transform Pipeline step to get rid of all unnecessary variables that you do not want to return: Transform Pipeline 3 Click View/Edit Pipeline and exclude all the output variables except isInteger using this arrow button: View/Edit Transform Pipeline Now we are ready to test the Flow Service.

Test the Flow service

First, don’t forget to save your Flow Service.

Save Flow service

Then, you can test it by clicking the play button:

Run Flow service

  1. When testing, you can save the input values as a value set, making it very simple to use the same inputs. In this case, there is only a single input, which you can set for example to “2” and then save the set as “good”. "Good" input data Then click Run and see that the result is true. Flow service result
  2. One more test, this time with invalid data. Set the input value for example to “2.75” and save it as “bad”. "Bad" input data Click Run and the result is false. Flow service result 2 Now, navigate to the Integration Runtimes tab and open the Default Cloud Runtime: Integration Runtimes tab Check your Debug logs tab to make sure your service is logging correctly and there you should see both isInteger entries: Debug logs

Next steps

After you’ve mastered the creation and development of Flow services, you might be interested in learning how to use workflows to orchestrate Flow services across runtimes:

Use workflows to orchestrate Flow services across runtimes with webMethods.io Integration

Read full topic