Custom Code Invocation for Pre and Post Processor for Object Verbs

You can add pre and post processing logic to services to modify the request inputs. When you test, the services details of various stages in the service execution are presented to you for better debugging. All options in the Advanced section are optional. For more details, refer to Preprocessor and Postprocessor.

  • Custom Code Invocationsection appears. Configure the parameters for the preprocessor and postprocessor to filter the request and response objects for your business requirements. You can specify multiple preprocessors and postprocessors. This is supported for integration/Orchestration services and Object services.

    IMPORTANT: To invoke preprocessor and postprocessor, you must import a valid JAR file while creating an object service. The corresponding jars have to be uploaded to the Quantum Fabric console under the Advanced tab in the object service definition service definition.

  • Java Preprocessor and Postprocessor - The preprocessor and postprocessor are Java classes that implement ObjectServicePreProcessor and ObjectServicePostProcessor interfaces. A developer can write custom code in the execute method of the preprocessor or postprocessor class.

    • Under the Custom Code Invocation, follow these steps:
      1. Under Preprocessor, configure the following:
        • For Java, you can configure multiple Preprocessors. This is supported for Integration/Orchestration services and Object services. If you have defined your logic for multiple preprocessors in the uploaded JAR file in the service definition, you can then select the available one or other preprocessors. You can arrange the selected pre-processors to be executed in the desired order during the operation call.

          Select Java, and from the Class list, select a preprocessor class. You can select one or more classes.
          This step enables a developer to include any business logic on the data before sending the response to a mobile device.

      2.     Under Postprocessor, configure the following:
        • For Java, you can configure multiple Postprocessors. This is supported for Integration/Orchestration services and Object services. If you have defined your logic for multiple postprocessors in the uploaded JAR file in the service definition, you can select the available one or other post-processors. You can arrange the selected post-processors to be executed in the desired order during the operation call.

          Select Java, and from the Class list, select a postprocessor class. You can select one or more classes.
          This step enables a developer to include any business logic on the data before sending the response to a mobile device.

          You can rearrange the order of the classes to be executed, if required.
  • Preprocessor and Postprocessor interfaces in Object services

    ObjectServicePreProcessor

    Implement this interface and write your custom preprocessor logic by overriding execute method. You are provided with FabricRequestManager, FabricResponseManager and FabricRequestChain as method arguments.

     public interface ObjectServicePreProcessor {
    void execute(FabricRequestManager fabricRequestManager,
    FabricResponseManager fabricResponseManager, FabricRequestChain fabricRequestChain)
    throws Exception;
    }

    Method arguments:
    FabricRequestManager :
     This argument specifies the different types of handlers to operate on request related information.
    FabricResponseManager : This argument specifies the different types of handlers to operate on response related information.
    FabricRequestChainThis argument specifies a chain similar to servlet FilterChain used to control the request flow.

    For a sample Java class code for ObjectServicePreProcessor, refer to Java Sample Code for Preprocessor - Object services.

    ObjectServicePostProcessor

    Implement this interface and write your custom postprocessor logic by overriding execute method. You are provided with FabricRequestManager and FabricResponseManager as method arguments.

     public interface ObjectServicePostProcessor {
    void execute(FabricRequestManager fabricRequestManager,
    FabricResponseManager fabricResponseManager)throws Exception;
    }

    Method arguments:
    FabricRequestManager :
     This argument specifies the different types of handlers to operate on request related information.
    FabricResponseManager : This argument specifies the different types of handlers to operate on response related information.

    For a sample Java class code for ObjectServicePostProcessor, refer to Java Sample Code for Preprocessor - Object services.

    IMPORTANT: Limitations of custom code invocation in Object services are as follows:

    -  Custom code is not invoked when Bulk Sync V2 APIs are in use.
    -  Custom code is not invoked when orchestration services which make use of Object services are in use.
    -  Custom code is not invoked when we use Quantum Fabric console test API.

    NOTE: For Quantum Cloud / For on-premises: Runtime jars to write custom code can be downloaded from Admin console. In the Downloads section, you can download the middleware jars as a zip file. Here the middleware-api.jar will have all the classes related to custom code.

    NOTE: For details on middleware APIs for preprocessor and postprocessor,
    contact refer to http://docs.kony.com/konylibrary/integration/MiddlewareAPI/index.html

    You can enable the application for offline synchronization, publish the application, and then provide the code that Quantum Fabric generates to a mobile application developer.

NOTE: Refer to Advanced Configurations for Verbs section for all the supported Advanced Configurations for Obects Service Verbs.