Export can run independently from the calling application. This is called out of process. Out-of-process conversions protect the stability of the calling application in the rare case when a malformed document causes Export to fail. You can also run Export in the same process as the calling application. This is called in process. However, it is strongly recommended you convert documents out of process whenever possible.
The Export out-of-process framework uses a client-server architecture. The calling application sends an out-of-process conversion request to the Service Request Broker in the main Export process. The Broker then creates, monitors, and manages a Servant process for the request—each request is handled by one independent Servant process. Data is exchanged between the application thread and the Servant through TCP/IP sockets. The source data is sent to the Servant process as a data stream or file, converted in the Servant, and then returned to the application thread. At that point, the application can either terminate the Servant process or send more data for conversion.
Multiple conversion requests can be sent from multiple threads in the calling application simultaneously. All requests sent from one thread are processed by the Servant mapped to that thread. In other words, each thread can only have one Servant to process its conversion requests.
Any standard conversion errors generated by the Servant are sent to the application.
NOTE: Currently, the main Export process and Servant processes must run on the same host.
The following are requirements for running Export out of process:
The following methods run in-process or out of process:
convert
convertTo
getSummaryInfo
NOTE: When converting out of process, these methods must be called after the call to start an out-of-process session and before the call to end an out-of-process session.
Other HTML Export methods and the File Extraction methods always run in-process.
Although most components of the out-of-process conversion are transparent, the following parameters are configurable:
File-size threshold/temporary file location
Conversion time-out
Listener port numbers and time-out
Connection time-out and retry
Servant process name
These parameters are defined internally, but you can override the default by defining the parameter in the formats_e.ini
file. The formats_e.ini
file is in the directory install\OS\bin
, where install
is the path name of the Export installation directory and OS
is the name of the operating system.
To set the parameters, add the following section to the formats_e.ini
file:
[KVExportOOPOptions] TempFileSizeMark= TempFilePath= WaitForConvert= WaitForConnectionTime= ListenerPortList= ListenerTimeout= ConnectRetryInterval= ConnectRetry= ServantName=
Each parameter is described in the following table.
The default values for these parameters are set to ensure reasonable performance on most systems. If you are processing a large number of files, or running Export on a slow machine, you might need to increase some of the time-out and retry values.
To convert files out of process
If required, set parameters for the out-of-process conversion in the formats_e.ini
file. See Configure Out-of-Process Conversions.
Instantiate an HtmlExport
object.
Define the conversion options.
Initialize an out-of-process session.
Convert the input and/or call other functions that can run out of process.
Shut down the out-of-process session.
Repeat Step 3 to
Terminate the out-of-process session and the Servant process.
Shutdown the Export session.
To ensure that multithreaded conversions are thread-safe, you must create a unique context pointer for every thread by HtmlExport
object
All
When terminating an out-of-process session, persist the Servant process by setting the Boolean flag bKeepServantAlive
in the endOOPSession
method. If the Servant process remains active, subsequent conversion requests are processed more quickly because the Servant process is already prepared to receive data. Only terminate the Servant when there are no more out-of-process requests.
To recover from a failure in the Servant process, start a new out-of-process session. This creates a new Servant process for the next conversion.