Invoking an import or a Java component from a custom mediation primitive

A custom mediation primitive allows you to invoke an import in order to use a service that is external to the mediation flow. In the same manner, you can invoke an external Java™ component.

If you want invoke an external service from a mediation flow and then return the results to the flow for further processing, you can invoke an import from a custom mediation primitive. For example, you may want to use an existing component or process from a different module, by invoking an import. Or, you may want to reuse existing Java code by invoking a Java component.

To implement a custom mediation primitive that invokes an external service or a Java component, you need to configure the following elements:

In the Assembly editor:
  • An import that has the interface of the external service that you wish to call, or a Java component that contains the Java class you want to invoke.
  • A mediation flow component that has a matching reference to the interface of the import or Java component.

In the Mediation flow editor:

When the input message is received by the custom mediation primitive, it is passed to the interface of the import or Java component. If the operation returns successfully the response from the import or Java component is propagated to the primitive's output terminal. If the operation returns unsuccessfully, the fail terminal propagates the original message, together with any exception information.

Follow these instructions to invoke an import or Java component from a custom mediation primitive.

  1. In the Mediation Flow editor, add the custom mediation primitive Picture of custom mediation icon to the canvas, and wire the input and output terminals.
  2. Select the custom mediation primitive on the canvas to view its properties. In the properties view, click the Details tab.
  3. Click the Invoke button.
  4. At the warning dialog, click Yes to continue.
  5. In the Reference list, select a partner reference that matches the interface of the import or Java component that you want to invoke. You can select an existing reference, or create a new one from a new or existing interface.
  6. In the Operation list, select the operation that you want to invoke. The root is set for you based on your selection.
  7. Save your changes in the mediation flow editor.
  8. If you created a new reference for your custom mediation primitive, you will need to add the reference to the mediation flow component. In the assembly editor, select the mediation flow component, right-click and Synchronize Interfaces and References > from Implementation.

    Note: The Merge Implementation action that was available in earlier versions of WebSphere® Integration Developer has been replaced with the Synchronize interfaces and references action.

  9. Add an import or Java component to the assembly diagram, and specify the interface of the component that you are invoking, or the service that you are importing.
  10. Wire the mediation flow component to the import or Java component.
Related concepts
Tips for creating Custom mediation primitives
Related tasks
Creating Java code in a custom mediation primitive
Migrating a custom mediation primitive

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.