clsMicroservice Step

Use this step to run a microservice.

Last published at: September 17th, 2024

Description:

This step runs a FlowWright Microservice. 

 

Inputs

  • selMicroService: Select microservice from dropdown. 
  • ParamsMapping: Mapping of inputs & output params fields.
 

 

Returns

  • True – step executed successfully
  • False – step failed to execute
 

      

Usage:

 

 

Example:

Let’s build a workflow called “Add2NosDef” to sum two numbers, for example.            

  • Navigate to the Create - Process Definition page. 
  • Create a new definition called “Add2NosDef”
  • Select the definition and click the “design” button
  • Drag a "evalExpression" step to the canvas
  • Connect the dots between the start and “evalExpression” step as shown below

 

 

  • Click the “evalExpression” step to configure its “Settings” properties. Give the step a name. Provide the expression to evaluate. Provide a variable/global to store the expression result. Click the Save button to confirm. 

 

  • Save the process definition. The process step should execute the “evalExpression” step and store the result in the variable/global configured.

 

Let’s build a microservice, “AddTwoNumbers," for example.            

  • Navigate to Integration - Microservices page. 
  • Click on the Actions - Create menu option to create a microservice. Provide a name to the microservice. Provide the description. Configure the HTTP method, Authentication, and Logging function as shown below. Select the workflow definition “Add2NosDef” from the drop-down list. Configure the Process Instance to ON to save the instance.  Select the Variables or Globals filter to map the input values. Provide the variable/global name and the description. Click the Add button to confirm. You may repeat this activity to include more variables/globals for the input. Likewise, select the Variables or Globals filter to map the output values. Provide the variable/global name and the description. Click the Add button to confirm. You may repeat this activity to include more variables/globals for the output. Click the Save button to confirm. 

 

 

You must build the microservice before using it. On the Manage Mircoserivce page, select the microservice from the list and click on the API - Build menu option. The microservice is built in the background, and the application restarts. You'll need to log in again to continue. The build log errors are available in the Build Log menu option. 

 

Let’s build and execute the “clsMicroServiceDef” step example.            

  • Create a new definition called “clsMicroServiceDef”
  • Select the definition and click the “design” button
  • Drag a "clsMicroService" step to the canvas
  • Connect the dots between the start and “clsMicroservice” step, as shown below. 

 

 

 

  • Click the button to configure parameters and values' input/output mapping. Provide variable/global references to the input and output parameters. Click on “Save” to confirm the changes.  

 

  • Save the process definition, create a new process instance, and execute. The process step should execute the microservice of “AddingTwoNumbers” and store the output in the variable/global configured in the output params.

 

Definition Sample:

You may download the sample definition from the link here and later import it (drag-drop) to your FlowWright Process (XML) and Form Definition (HTML) page. After import, you will need to verify the process steps and complete the database configuration, if any. 

 

Workflow example to Add 2 Numbers

https://github.com/FlowWrightCode/FW10Steps/blob/main/Add2NosDef.xml 

 

Microservice example, which executes a workflow to Add 2 Numbers

https://github.com/FlowWrightCode/FW10Steps/blob/main/AddTwoNumbers-Microservice.xml 

 

Workflow example with “clsMicroService” step to execute a Microservice

https://github.com/FlowWrightCode/FW10Steps/blob/main/clsMicroServiceDef.xml