Create and Test Microflow Service
Last updated
Last updated
Steps to create Microflow service:
Log in to ONEWEB AppSpace and choose component as Microflow. Log in to ONEWEB platform using given Id/ password and you will be directed to ONEWEB AppSpace home page. Select your Application project. Under components, select Microflow as shown as 1 and click on “Create Flows”, a slider configuration screen would open as shown in fig1b. Give Component name i.e your micro service flow name as “Retrieve_Benefits”, and Description is (optional) as shown in fig 1b. Click on “Start Design” button.
Create Input Business Object Choose Business Object tab, and define your Input Business Object, Select “Input Process Parameter”. There are 2 blue icons appeared with it, as shown in Figure 3. Click on Add Parameter Icon as shown (1), Parameter Form window would open. Write Parameter Name as “BenefitBOin_[yourname]”
Note: BO can’t be created with the same name twice so user must assign a unique Id along with your Business Object Parameter Name.
Select Parameter Type as “Object” as shown in Figure 4 and click on Submit.
Create Output Business Object Two Input Process Parameters named as “benefit_type” and “username” should be appeared under your Input BO (business object) as shown in Figure 6.
Next is to create “Output Business Object” and Add Output Business Object Process Parameters. Select “Output Process Parameter”. Click on Add Parameter Icon, Parameter Form window would open as shown in Figure 6. Write Parameter Name as “BenefitBOout_[yourname]”, Parameter Type as “Object”. Mark it as List parameter. Click on Submit.
Create Output Business Object Parameters Add Output Business Object Process Parameters. Select “Output Process Parameter. Click on Add Parameter Icon as shown in Step 1, Parameter Form window would open as same in Figure7. Add Multiple Parameters, w.r.t Parameter Name and Type as “id” (Type =>String) “travel_date” (Type =>Date), “project_name” (Type =>String), “description” (Type =>String), “amount” (Type =>Decimal), “status” (Type =>String), “benefit_type” (Type =>String) and “username” (Type =>String)”. Click on Submit.
Verify BO name and All parameters. Window will open to display all information about your Input and Output Business Objects and all Process Parameters created under each Business Objects as shown in Figure 8. Verify your Input and Output Business Object names, along with their respective Process parameter names and their respective data types. Once Verified, Click on Next.
Next is to Create a Business Process workflow. For this sample practice session, we will create a sample process using Database Activity Node. So, in this example you would learn how to configure a Database Node in microflow service to retrieve information from an existing database. Drag and Drop 3 Activity nodes – “Start”, “Database” and “End” inside your Design workflow configuration screen as shown in Figure 10.
FYI: Once you are able to retrieve information, it can be integrated with Mobile UI screen (designed in previous section 7.5.1.2) and displayed via application run time. Microflow integration with UI will be covered in next section 7.4.1.4.
Create a link between all three Activity Nodes – “Start”, “Database” and “End’ as shown in Figure 11. Save your Process.
Configure your Node Task – Database Node
Configure your Database Activity Node, Click on Database Node as shown (1) in Fig 12. Three tabs will be shown below for configuration purposes – General, BusinessObject and Database Parameter. General Tab is Optional and helps you to rename node and add description, if required. Select “BusinessObject” (1) tab, choose Input Business Object from the list, tick mark an Input checkbox (2). Click on Add Row(3), choose Output Business Object from the list (4), tick mark an Output checkbox. Click on Open Mapping parameter (5) as shown in Figure 13.
Map Input parameters of BenefitBO-input to Activity Parameter.
Click on link between Input and Mapping as shown as (1) in Figure 14. Drag and create a link between BenefitBO_input to Activity Parameter as shown as (2) in Figure 14.
Map Output parameters
Click on link between Mapping and Output as shown as (1). Drag and create a link between BO_Output to BO_Output of Output Process Parameter as shown as (2). Click on Done (3) button to save your mapping.
Configure Database Parameter Tab.
Select connection Type as JNDI as shown (1) in Figure 18. Select JNDI Name as “jdbc/application”. Select Command Type as “Select” Enter below SQL query in command "SELECT id, travel_date, project_name, description, amount, status, benefit_type, username FROM oneweb_benefit WHERE benefit_type = ? AND username = ?" Click on Open Mapping Parameter.
Create Database DummyObject Parameters here and perform mapping,
Select a link between Input and Mapping as shown (1). Click on DatabaseDummyObject as (2), and add 2 parameters as “benefit_type” and “username” as shown in step (3). Link Activity Parameters with Database Parameters as shown in step (4) & (5) in Figure 17.
Map Database Parameter back to Activity Parameter, Click on link between Mapping towards Output as (1) and Select an icon associated with DatabaseDummyObject as (2) and Add Multiple Parameters, w.r.t Parameter Name and Type as “id” (Type =>String) “travel_date” (Type =>Date), “project_name” (Type =>String), “description” (Type =>String), “amount” (Type =>Decimal), “status” (Type =>String) as shown in Figure 18. Map DatabaseDummyObject to BenefitBO_output as shown as step (3) in Figure 18. Click Done and save your settings.
Select Database Parameter tab. Review your settings and click on Done as shown in Figure 19.
FYI: Click Close on the top right corner hand side in order to close the mapping diagram page.
Click “Save” on the top right hand side on your workflow window to save your workflow configuration. Proceed to Simulation Test tab.
Perform Simulation Test to test this Service Output: Click on simulation Tab. Edit parameter in Json as following: “benefit_type”: “Travel” "username”: “Alisha” Click on Start. Verify Database w.r.t Microflow Output as shown in Figure 21.
Now if you complete the testing, and this microflow produce expected results as shown above in Figure 21. Proceed next to integrate this Microflow service with Mobile UI screen in next section.
Create Input Business Object Parameters. Next is to Add Input Process Parameters for your Input Business Object, Select your “Input Business Object”. Click on Add Parameter icon . Write Parameter Name as “benefit_type”, select Parameter Type as “String” as shown in Figure 5. Add another Parameter (same as step1) w.r.t Parameter Name as “username” and Parameter Type as “String”. Click on Submit.