External Processor Examples

Three examples of the external processors can be downloaded. The examples file contains:

  • The Java source code of the external processors.
  • The External-Processor-Examples.xml file, which provides an exported sample Content Capture Procedure.

The examples are in the file capture-examples.zip or capture-examples.tgz. You can download the file from here: https://your-ocm-service/capture/api/sdk/capture-examples.tgz or https://your-ocm-service/capture/api/sdk/capture-examples.zip.

The examples illustrate three different models of interaction between Content Capture and an external processor. The first two examples are of the push model and illustrate both the synchronous and asynchronous response types. The third is an example of the pull model.

Note:

Only Example 3 is described in this section as seen below. The first two examples use the push model, which is deprecated and under maintenance. The documentation for Examples 1 and 2 will become available when the push model is updated and re-released.

The included Content Capture Procedure provides sample configurations for calling the examples. It contains the necessary metadata fields, document profiles, and job definitions. It also provides a Capture client profile to create and release documents into the Procedure flow.

After the Content Capture Procedure is imported:
  • In the Example 3 code, the unique Processor Step identifier will be updated by the import and its new value will need to specify on the command line as a standard Java property (i.e. -Doracle.ocm.capture.examples.externalprocessor.step-id=54cd7e16-5440-46a7-a5d4-6878b38c8b97).

Example 3: Resize Image (Pull Model)

This example shows how to develop an external processor using the pull model. This external processor will accept an image document which it will scale by a given percentage and then return the scaled document to replace the original document in Content Capture. The following elements are illustrated:

  • The external processor periodically polling Content Capture for documents that need processing.
  • When the documents are available, the Content Capture responds with a document JSON object containing the metadata fields associated with each waiting document, including a scale value.
  • For each waiting document, the external processor:
    • retrieves the image file using the Capture get document content API method
    • resizes the image document by the scale value
    • sends the resized image file back to Content Capture to replace the original file using the document update API method
    • indicates the processing of the document is completed using the Capture complete document task API method

There is one metadata field used for the example is Scale. It needs to contain a value between 1 to 100 that represents the percentage to scale or resize the image from its present size.