Skip to end of metadata
Go to start of metadata

The Class Mediator creates an instance of a custom-specified class and sets it as a mediator. The class must implement the org.apache.synapse.api.Mediator interface. If any properties are specified, the corresponding setter methods are invoked once on the class during initialization.

Use the Class mediator for user-specific, custom developments only when there is no built-in mediator that already provides the required functionality. Maintaining custom classes incurs a high overhead. Therefore avoid using them unless the scenario is frequently re-used and very user-specific.

For best results, use WSO2 Developer Studio for debugging Class mediators.


UI Configuration

Class Name: The name of the class. To load a class, enter the qualified name of the relevant class in this parameter and click Load Class


You can configure the mediator using XML. Click switch to source view in the Mediator window.


In this configuration, the ESB sends the requested message to the endpoint  specified via the Send mediator . This endpoint is the Axis2server running on port 9000. The response message is passed through a Class mediator before it is sent back to the client. Two parameters named  variable1  and  variable2  are passed to the instance mediator implementation class ( SimpleClassMediator ).

See the following sample Class Mediator and note the SynapseMessageContext and the full Synapse API in there.


For more examples, see:

  • No labels