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

 View Only
Wed February 07, 2024 04:00 AM

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:
:film_projector: 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:

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

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:

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

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

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:

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:

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.

  1. 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.

  1. 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:

  1. 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:

Click on the View/Edit Pipeline option:

Click on the subString under the Input – IndexOf column and set the value to “.”. Click Save and close the View/Edit wizard.

  1. 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:

  1. In this case, we can add a Transform Pipeline step and set the isInteger Pipeline output string to true:

  1. 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.

Click the View/Edit button and open the Input - debugLog message string. Enable Perform variable substitution and type a message:

Use the following button to search for substitution variables:

Click Save and exit the View/Edit window.

  1. Lastly, add one more Transform Pipeline step to get rid of all unnecessary variables that you do not want to return:

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.

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

  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”.

Then click Run and see that the result is true.

  1. One more test, this time with invalid data. Set the input value for example to “2.75” and save it as “bad”.

Click Run and the result is false.

Now, navigate to the Integration Runtimes tab and open the Default Cloud Runtime:

Check your Debug logs tab to make sure your service is logging correctly and there you should see both isInteger entries:

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

Useful links | Relevant resources


#webMethods-io-Integration
#Super-iPaaS
#webMethods
#webMethods-cloud