Docs Menu
Service
The service behaves like functions in the programming languages. A function is first defined and then called for its proper usage. The main advantage of using services is that it aids in better reusability of program code. On the Syncloop API development Platform, the service behaves like same and can be an API Service, SQL Service, or Java Service. These services once called can be reused in another API service. The various input and output parameters associated with that service will also get imported while calling this service. These parameters can even be mapped with the local parameters of the API service. Multiple services can be called in a single API service that provides a robust platform for continuous Service integration on the Syncloop Platform.
To call an already created API or Java service in an existing API Service, right-click on the workspace and select the Service option in the API DESIGNER context menu.
This will display a select service pop-up.
Search the service in the Package Explorer and select the service by clicking on it. Click on the done button and the service will be added as a workspace step.
In the Service Step, an API Service, SQL Service, or a Java Service can be called.
Services also follow recursion i.e. (The service can call itself). The limitation of recursion is that the service can recursively call itself only up to one hundred times. Therefore, the execution of these recursive services needs to be kept at a limit by using appropriate condition checks.
The Services are classified as Asynchronous or Synchronous
Asynchronous Services
In this type of Service call, other API/Java/SQL services continue to operate while waiting for another service call to return. In the case of Asynchronous services, the code execution does not block (or wait) for the API call to return from the server. Execution continues on in your service, and when the call returns from the server, a callback service is executed. On the Syncloop platform, we create an object that stores the task info and the output. Whenever output is needed a service name Wait is called in which task id is given as input. It will wait for the task to complete and once it is completed it will populate the object with the new output.
Synchronous Services
In this type of Service call, other API/Java/SQL services wait until the service returns and during this period all other services are stopped. The code execution will block (or wait) for the API call to return before continuing. The service wait is achieved using a wait service that enables the application to wait for the service to get completely executed. This means that until a response is returned by the API, your application will not execute any further, which could be perceived by the user as latency or performance lag in your app. Making an API call synchronously can be beneficial, however, if there is code in your app that will only execute properly once the API response is received.