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:
- A custom mediation primitive, with wired input and output terminals.
- A reference that matches the interface of the service or Java component
that you wish to call.
- The operation of the interface that you wish to call.
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.