# Control component classification

Version requirement: v2.2 or above

FizzGate currently has two built-in components:

  • Judgment condition component: used to determine whether to execute the current step or request. Multiple conditions can be added. There is an AND relationship between multiple conditions. When the component returns true, the execution continues.

  • Loop component: used to loop through the current step or request. Only one can be added and fixed after all judgment conditions. If conditional judgment is needed inside the loop, loop conditions and exit conditions can be configured in the loop component.

# Reference value

Reference values can be used for judgment conditions and loop components. For reference value specifications, please refer to:

[Quote value specification](https://www.fizzgate.com/fizz/guide/aggregate/configuration.html#%E5%BC%95%E7%94%A8%E5%80%BC%E8%A7%84 %E8%8C%83)

# Reference the current loop object

Within the request cycle, you can refer to the current cycle object through stepN.requestM.item, such as:

step2.request1.item.name can get the value of the name field of the loop object. When the data source is a number, item is a number starting with 1. Step2.request1.index can get the subscript of the current loop object. The subscript starts from 0. start

Within a step loop, the current loop object can be referenced through stepN.item, such as:

step2.item.name can get the value of the name field of the loop object. When the data source is a number, item is a number starting with 1. Step2.index can get the subscript of the current loop object;

# Reference loop results

The result of the loop call is an array, which can be obtained by reference value, such as:

Loop request:

step2.request1.circle[0].response.body can get the result of the first loop request,

step2.request1.circle[-1].response.body can get the result of the previous loop request,

step2.request1.circle[*].response.body can get the response results of all circular requests;

Cycle steps:

step2.circle[0].request1.response.body can get the result of the first loop step,

step2.circle[-1].request1.response.body can get the result of the previous loop step,

step2.circle[*].request1.response.body can get the response results of all loop steps

The code field of the response to request1 in tep1;

message: reference type, the value is the message field of the response to request1 in step 1;

data: reference type, the value is the data field of the response to request1 in step 1 and use the fn.list.rename function to rename the field.

aggr_fn_list_rename_3

# Test

The response obtained by directly calling the /fn-list/user-basic-info-list-by-role/admin interface is as shown in the figure.

aggr_fn_list_rename_4

The test interface gets the response as shown in the figure.

aggr_fn_list_rename_5

From the response of the test interface, we can see that the service orchestration interface has completed the request to the /fn-list/user-basic-info-list-by-role/admin interface and correctly extracted the field list of the response data field.

# List field removal fn.list.removeFields

This example calls the /fn-list/user-basic-info-list-by-role/{role} interface of the underlying fizz-examples-rest-api service in the orchestration interface (interface source code: [FnListController](https:// github.com/wehotel/fizz-examples/blob/master/fizz-examples-rest-api/src/main/java/we/controller/FnListController.java)) to obtain the user’s basic information list and respond to this interface The data undergoes list field removal to fit our desired data format.

# Basic information

aggr_fn_list_remove_fileds_1

# Configuration input

In this example we do not need to enter parameters, leave them all blank.

# Configuration steps

Add a new step step1, and then add a request request1 in step step1. Select fizz-examples-rest-api as the service and request the /fn-list/user-basic-info-list-by-role/admin interface.

aggr_fn_list_remove_fileds_2

# Configure output

Configure the response message to be returned to the front end. Here, the response body is configured with the following fields:

code: reference type, the value is the code field of the response to request1 in step 1;

message: reference type, the value is the message field of the response to request1 in step 1;

data: reference type, the value is the data field of the response to request1 in step 1 and use the fn.list.removeFileds function to remove the role, nickname, and sex fields.

aggr_fn_list_remove_fileds_3

# Test

The response obtained by directly calling the /fn-list/user-basic-info-list-by-role/admin interface is as shown in the figure.

aggr_fn_list_remove_fileds_4

The test interface gets the response as shown in the figure.

aggr_fn_list_remove_fileds_5

From the response of the test interface, we can see that the service orchestration interface has completed the request to the /fn-list/user-basic-info-list-by-role/admin interface and correctly removed the fields from the list of response data fields. .

# Introduction to FizzGate Integration Platform

FizzGate is a microservice aggregation gateway developed based on Java. It can achieve hot service orchestration and aggregation, automatic authorization selection, online service script coding, online testing, high-performance routing, API audit management, callback management, etc., and has powerful customization The plug-in system can be expanded by itself and provides a friendly graphical configuration interface, which can quickly help enterprises manage API services, reduce middle-layer glue codes, reduce coding investment, and improve the stability and security of API services.

Official website: https://www.fizzgate.com (opens new window)

GitHub: https://github.com/fizzgate/fizz-gateway-node (opens new window)

Code cloud: https://gitee.com/fizzgate/fizz-gateway (opens new window)

Getting Started Tutorial: https://www.fizzgate.com/fizz/guide/GettingStarted/ (opens new window)

Advanced tutorial: https://www.fizzgate.com/fizz/guide/advanced/ (opens new window)


Author: ZHONG.J