View source | View content page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Show collection (0 pages)
Collections help

Search

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

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.

Bulbgraph.png   Ability to force Asynchronous or Synchronous execution modes available since version 2.0.XXX

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

  1. Create a EDL Process that generates a JSON to be send using the WSRest Output Processor.
    1. Check the Enable Output Retry flag.
  2. Configure the EDL Process using the WS Rest output with a wrong URL.
    1. Configure the retry with a Max Retry Number of 5 and a Retail Interval of 100 ms.
  3. Execute the Process once
    1. Check the logs for the 5 executions with failure.
  4. Open the EDL Configuration and increase the Retail Interval to 2000ms
  5. Execute again the Process and before the 5 attempts are done set up a correct URL.
    1. Check that when the ELD Request finish successfully.
    2. Check the logs to see that the first attempts failed and when the URL was fixed the next attempt was successful.
  6. 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:

Bulbgraph.png   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.

EDL-Configuration.png

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.
Bulbgraph.png   The Output Retry has to be enabled with caution to avoid performance issues in other processes that are run in parallel. Main reasons for these performance issues:
  • The database connection is not closed until all attempts are done. Make sure that the EDL Process is not creating any lock that could affect other processes.
  • The thread is not released until all the attempts are done. This is specially troublesome in asynchronous processes as they are executed on a thread of the Import Entry Processor, so any process using Import Entries might be affected.

Retrieved from "http://wiki.openbravo.com/wiki/Projects:External_data_loading_process/Forced_Synch_Mode_and_Retry_Output_Contribution"

This page has been accessed 109 times. This page was last modified on 15 May 2017, at 10:15. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.