Scenario: Developing receiver user exits

To develop receiver user exits, you must develop OSGi services that include the provided user exit APIs.

Before you begin

You must be an experienced programmer in Java™, Open Services Gateway Initiative (OSGi) services, and OSGi bundles. The public user exit Java APIs must be exported as an OSGi service in your OSGi bundle.
Remember: There can be more than one OSGi service in your OSGi bundle.

About this task

To develop receiver user exit OSGi services:

Procedure

  1. Locate the Members\resources\userexits installation directory.
  2. Set up your development environment.
    1. Download the user exit API JAR file from the Members\resources\userexits installation directory.
    2. Verify that your integrated development environment (IDE) is configured for OSGi development.
    3. Optional: Download the latest Eclipse IDE and either Equinox SDK or Apache Aries: Maven Plug-in.
    4. Optional: Download the latest WebSphere® Application Server V7 Feature pack for OSGi Applications and JPA 2.0.
    5. Modify your /META-INF/MANIFEST.MF file to match your implementation.
    6. Optional: For Maven plug-in implementations, modify your /META-INF/pom.xml and META-INF/pom.properties files to match your implementation.
    7. Optional: For Blueprint Container implementations, modify your /OSGI-INF/blueprint.xml file to match your implementation.
  3. Implement the appropriate user exit API.
    PreProcessUserExitHandler
    The PreProcessUserExitHandler is used in the receiver process flow before a message enters the receiver process flow.
    PostProcessUserExitHandler
    The PostProcessUserExitHandler is used in the receiver process flow after a message exits the receiver process flow.
    BusinessDocument
    The BusinessDocument is used to handle the message, payload, attachments, transport headers, and message properties in the process flow.
  4. Debug your OSGi components in your local IDE.
    Restriction: User exits cannot be tested in your local development environment. You must deploy the user exit OSGi services on the system for testing.
  5. Assemble your receiver user exit OSGi services and prepare your userexit_bundle-SymbolicName.jar OSGi bundle for deployment on the system.
  6. To deploy your authentication user exit bundle, locate the bin directory.
    Important: You must repeat this procedure for each node that requires this user exit.
  7. To load your user exit OSGi bundle into the data grid, type execute user_exit load <path to userexit_bundle.jar>
  8. To deploy your user exit OSGi bundle on your current node, type execute user_exit config <userexit_bundle-SymbolicName>|all
    Important: If you update an existing user exit on the system, you must restart the member.
  9. Optional: Restart the member:
    1. To stop the member, type execute member stop operational
    2. To start the member, type execute member start operational or execute member start_service operational
  10. Optional: To verify your user exit deployment, type execute user_exit list

Example

API code snippet for pre-processing and post-processing receiver user exit points.

/**
 * Interface for pre-processing user exit point for the receivers
 *
 */
interface ReceiverPreProcessHandler {
    public BusinessDocument invoke( BusinessDocument doc ) 
	throws B2BReceiverException;
}

/**
 * Interface for post-processing user exit point for the receivers
 *
 */
interface ReceiverPostProcessHandler {
    public BusinessDocument invoke( BusinessDocument doc )
	 throws BReceiverException;
}

What to do next

You can now manage and configure your user exits in the process flows for AS4 receivers and AS4 messaging receivers.

Tip: To edit deployed user exit OSGi bundles, type execute user_exit export <userexit_bundle-SymbolicName> <directory location for exported files>. You can then edit the OSGi bundle locally and modify, debug, and test before you deploy the modified OSGi bundle again.