- Open the Developer Studio Dashboard (choose Developer Studio -> Open Dashboard) and click Template in the ESB Enterprise Service Bus area.
- Select Import a Template and click Next.
- Specify the XML file that defines the template by typing its full pathname or clicking Browse and navigating to the file.
- In the Save Template In field, specify an existing ESB Config Project in your workspace where you want to save the template, or click Create new Project to create a new ESB Config Project and save the template configuration there.
- If there are multiple template definitions in the file, click Create ESB Artifacts, and then select the templates you want to import.
- Click Finish. The templates you selected are created in the subfolders of the src/main/synapse-config/templates folder under the ESB Config project you specified, and the first template appears in the editor.
Creating a mediator
A mediator project allows you to create a custom mediator that performs some logic on a message. You
can create a new mediator project, or you
can import an existing mediator project from the workspace.
Because a mediator is an extension to the server that applies to all applications, do not deploy the mediator as a Composite application.
Creating a mediator
Follow these steps to create a new mediatorOnce the mediator project is finalised, you can export it as a deployable artifact by right-clicking on the project and selecting Export Project as Deployable Archive. This creates a JAR file that you can deploy to a WSO2 ESB. Alternatively, you can .
group the mediator project as a Composite Application Project, create a Composite Application Archive (CAR), and deploy it to the ESB.
From ESB 4.8.1 onwards, a URL classloader is used to load classes in the mediator (class mediators are not deployed as OSGi bundles). Therefore, it is only possible to refer to the class mediator from artifacts packed in the same CAR file in which the class mediator is packed. Accessing the class mediator from an artifact packed in another CAR file is not possible. However, it is possible to refer to the class mediator from a sequence packed in the same CAR file and call that sequence from any other artifact packed in other CAR files.
Follow these steps to create a new mediator. Alternatively, you can import a mediator project.
- Open the Developer Studio Dashboard (click Developer Studio > Open Dashboard) and click click Mediator Project in in the ESB Enterprise Service Bus area.
- Leave the first option selected and click click Next.
The The New Mediator Creation Wizard appears.
- Do the following:
- Type a unique name for the project.
- Specify the package and class names you are creating.
- Optionally specify the location where you want to save the project (or leave the default location specified).
- Optionally specify the working set, if any, that you want to include in this project.
- A Maven POM file will be generated automatically for this project. If you want to include parent POM information in the file from another project in this workspace, click click Next, click the the Specify Parent from Workspace check check box, and then select the parent project.
- Click Click Finish.
The mediator project is created in the workspace location you specified with a new mediator class that extends extends
Java Mediator Project
Follow these the steps below to import an existing mediator project into an ESB Config project. Alternatively, you can create a new mediatora Java mediator project (that includes a Java class, which extends the
org.apache.synapse.mediators.AbstractMediator class) to WSO2 Developer Studio.
- Open the Developer Studio Dashboard (choose click Developer Studio - > Open Dashboard) and click click Mediator Project in in the ESB Enterprise Service Bus area.
- Select Select Import From Workspace and click and click Next.
- Specify the mediator project in this workspace that you want to import. Only projects with source files that extend extend
org.apache.synapse.mediators.AbstractMediatorare are listed. Optionally, you can change the location where the mediator project will be created and add it to working sets.
- Click Finish Finish.
The mediator project you selected is created in the location you specified, and the project now has the added project nature .
The mediator projects you create using WOS2 Developer Studio are of the
You can export this mediator project as a deployable artifact by right-clicking on the project and selecting Export Project as Deployable Archive. This creates a JAR file that you can deploy to a WSO2 ESB. Alternatively, you can group the mediator project as a Composite Application Project, create a Composite Application Archive (CAR), and deploy it to the ESB.