Projects:External data loading process/Forced Synch Mode and Retry Output Contribution
Contents |
Introduction
This document contains the requirements and the temporal documentation for Forced Synch Mode and Retry Output Process contributions.
Forced Execution Mode
Requirements
EDL Processes are defined to be executed Synchronously or Asynchronously. In some scenarios it is required that a EDL Request is executed in a different mode. New API is provided to execute EDL Request forcing the Synch Mode overriding the EDL Process configuration.
QA Testing
- Implement a EDL Process that can be executed in both modes.
- Launch it using the new api ProcessRequest.addRequestForceExecutionMode
- Check the process is run successfully using both modes.
Documentation
Modified EDL Process execution section in How to Implement a EDL Process document:
EDL Process execution
When a new process is defined it is also required to develop the needed processes to launch the requests. To create and process a new EDL Request it is required to use the ProcessRequest class. There are different addRequest() methods depending on the type of process to be executed.
The addRequest can be called from different type of processes: EventHandlers, processes (menu or window), exposed web services or background processes.
In case it is required to override the Execution Mode it is available the addRequestOverrideSynchrony() method. This method includes a boolean parameter overrideSynchrony to force the Execution Mode. When true the request is processed in Synchronous Mode and if false the request is processed in Asynchronouse Mode regardless of the EDL Process configuration. Note that not all the EDL Processes are developed to be executed in both execution modes.
It is also available a new addRequest() method with a Boolean parameter forzedSynchronousMode. If the parameter is null the EDL Process configuration is used. If true is set the process is executed in Synchronous Mode and if false is set it is executed in Asynchronous Mode.
For example in a WebService with direct response:
w = response.getWriter(); response.setContentType("application/json;charset=UTF-8"); response.setHeader("Content-Type", "application/json;charset=UTF-8"); ... if ("POST".equals(method) || "PUT".equals(method)) { String processId = "required edl process id"; ProcessRequest<?, ?> processor = ProcessRequest.getProcessRequestInstance(); processor.addRequest(processId, content, w);
Retry Output Execution
Requirements
The Output Processes are executed when the Request is processed. They are used to communicate or store the result of the Process. Some processes can fail by a temporary issue so a retry waiting a certain time can success. Typically this can happen when the output process relies on a call to a WebService which can be temporarily unreachable. It is required to be able to configure the output process execution to retry the process when it fails. This configuration should determine the maximum of retries and the time interval to wait.
QA Testing
- Create a EDL Process that generates a JSON to be send using the WSRest Output Processor.
- Check the Enable Output Retry flag.
- Configure the EDL Process using the WS Rest output with a wrong URL.
- Configure the retry with a Max Retry Number of 5 and a Retail Interval of 100 ms.
- Execute the Process once
- Check the logs for the 5 executions with failure.
- Open the EDL Configuration and increase the Retail Interval to 2000ms
- Execute again the Process and before the 5 attempts are done set up a correct URL.
- Check that when the ELD Request finish successfully.
- Check the logs to see that the first attempts failed and when the URL was fixed the next attempt was successful.
- Execute a third time the process and check that it is success on the first attempt and no retry is done.
Documentation
The Configuration section of the User Guide requires to be updated as follows:
Configuration
The configuration is done in the EDL Configuration window for each Client. A record for each EDL Process that is used on the Client has to be created. The header only has the EDL Process field. Note that the module that implements the selected process might include additional fields to fill.
In case the EDL Process generates an output it has to be configured the Output tab. In this tab have to be configured all the output processes required to be executed for each EDL Process. The EDL module includes 2 output types: Debug and WSRest. Debug prints a INFO in the Openbravo log with the output generated by the EDL Process. WSRest allows to configure a REST WebService to send the result of the EDL Process.
In case the EDL Process has the retry enabled it is possible to configure it by checking the Retail Enabled flag. When this is checked 2 additional fields appear:
- the Max Retry Number to define the number of times that the process can be retried before giving up and throwing the Error.
- the Retry Interval to determine the time in milliseconds to wait before doing the retry.
![]() | Configure the retry options with caution. High numbers can lead to blocks that might affect the performance of other processes until all the retry attempts are done. |
The retry is an ability aimed for WSRest output type processes where the configured WebService can be temporarily unreachable.
The EDL Process Definition section of the Hot to Implement a EDL Process requires to be updated as follows:
EDL Process definition
The EDL Process is defined in the EDL Process window as System Administrator. These are some common fields that need to be defined:
- Module
- The EDL Process must belong to an extension module. Make sure you have created one and it is in development.
- Name
- The name of the process is used as identifier in the EDL Configuration window to select the processes.
- Search Key
- The search key or value is used to retrieve the java class implementing the process.
- Type of Data
- Based on how is received or processed the data. Determines the type of each processed item and the type of a batch of items. The module includes a basic JSON implmementation. It is possible to develop new types to support different types like xmls, csvs,...
- Has Output
- If the process generates data that has to be processed by a Output processor this flag needs to be checked. When this flag is checked it is required to add at least one Output Process in the EDL Configuration window.
- Has Input
- In case the process starts by receiving some data that needs to be processed.
- Storage Location
- Determines how is stored the received raw data. Note that if No Stored is selected it might not be possible to reprocess a request in case of error.
- Synchronous
- Determines how the process is executed. Depending on this flag additional configurations are needed
- Enable Output Retry
- Enables to ability to configure the retry options on the EDL Configuration window.