Working with ESB Artifacts
The topics in this section provide information on how you can use WSO2 ESB Tooling to create an ESB Config project as well as information on how to create various ESB artifacts that you can build and deploy to the ESB in order to process requests. The tooling functionality is available from the Developer Studio dashboard in Eclipse.
- Getting Help in the Source View
- Creating an ESB Config Project
- Creating an ESB Solution Project
- Working with Inbound Endpoints
- Working with Endpoints
- Working with Local Registry Entries
- Working with Sequences
- Working with Connectors
- Working with Proxy Services
- Working with APIs
- Working with Tasks
- Working with Message Stores
- Working with Message Processors
- Working with Templates
- Working with Mediators
- Creating a Smooks Configuration Artifact
- Moving ESB artifacts between projects
- Deploying the ESB Config project
Getting help in the source view
When working with your ESB configurations in the Source view instead of the Design view, you can hover your mouse over any element (such as the definitions tag) to see the syntax of that element. You can also press Ctrl + Space
to get suggested auto-completion text.
For example, if you view a proxy service in the Source view, and you remove the /
from the <inSequence/>
element and press Ctrl + space
, the Content Assist appears and lists all the options you can add at this point, including the closing </inSequence>
element.
Creating an ESB Config Project
You can create an ESB Config Project to save all the ESB related artifacts such as proxy services, endpoints, sequences, and synapse configurations.
To create an ESB Config Project:
In Eclipse, click the Developer Studio menu and then click Open Dashboard. This opens the Developer Studio Dashboard.
- On the Developer Studio Dashboard click ESB Config Project.
- If you want to create this ESB project from existing configuration files, select Point to Existing Synapse-configs Folder. Otherwise, leave New ESB Config Project selected. Click Next.
- Do the following:
- Type a unique name for the project.
- If you selected the option to point to an existing Synapse-configs folder in the previous step, click Browse and navigate to the folder containing the configuration files.
- 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 Next, select the Specify Parent from Workspace check box, and then select the required parent project.
- Click Finish.
- If you specified a folder with existing configuration files, specify whether you want to open those files now.
The new project has now been created in the workspace. If you browse inside the project, you will see a project structure as follows, with folders created for different resources such as endpoints, inbound endpoints, local entries, message processors, message stores, proxy services, and sequences etc.
Creating an ESB Solution Project
You can create an ESB Solution Project to save all required project files you need for a particular configuration in one go. For example, if you need to create a project that requires an ESBConfig project, registry resource project, connector exporter project and composite application project, you can create an ESB Solution Project instead of creating each required project separately.
To create an ESB Solution Project:
In Eclipse, click the Developer Studio menu and then click Open Dashboard. This opens the Developer Studio Dashboard.
- On the Developer Studio Dashboard click ESB Solution Project.
- Do the following:
- Enter a unique name for the project.
- Select the projects you want to create and specify names for each project that you selected (or leave the default project names).
- 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.
- If you want to include parent POM information in the file from another project in this workspace, click Next, select the Specify Parent from Workspace check box, and then select the required parent project.
- Click Finish. The new projects will be created in the workspace. If you browse inside each project, you will see each project structure as follows:
Importing a Synapse configuration
A Synapse configuration file contains one or more ESB artifacts, such as endpoints and sequences. You can import an existing Synapse configuration to import all its ESB artifacts in one step.
Follow the steps below to import an existing Synapse configuration into an ESB Config project.
- Open the Developer Studio Dashboard (click Developer Studio > Open Dashboard) and click Synapse in the Enterprise Service Bus area.
- Specify the Synapse configuration file by typing its full path name or clicking Browse and navigating to the file.
- In the Save Synapse Configuration in field, specify an existing ESB Config project in your workspace where you want to save the configuration, or click Create new ESB Project to create a new ESB Config project and save the Synapse configuration there.
- Select the artifacts you want to import.
- Click Finish. The artifacts you selected are created in the subfolders of
src/main/synapse-config
folder under the ESB Config project you specified, and the first artifact appears in the editor.
Creating a Smooks configuration artifact
Smooks is an extensible framework for building applications that process data, such as binding data objects and transforming data. To create a Smooks configuration artifact, you must first create a registry resource as described in Creating Governance Registry Artifacts. When creating the registry resource, select the From Existing Template option and select Smooks Configuration as the template.
The smooksconfig.xml
file is created. Double-click it in the Project Explorer to open it in the embedded JBoss Smooks editor.
Click Input Task, create the data mapping, and save the configuration file.
Before you can run the Smooks configuration, you must add libraries from the Smooks framework to your registry resources project.
- Right-click the registry resources project in the Project Explorer and click Properties.
- In the list on the left, click Java Build Path, and then click the Libraries tab.
- Click Add Library, click WSO2 Classpath Libraries, and then click Next.
- In the WSO2 Classpath Libraries dialog box, click the Smooks tab, click Select All, and click Finish.
- In the Properties dialog box, click OK.
All the Smooks-related libraries have been added to the project classpath. You can now run the Smooks configuration file by right-clicking the file and choosing Run As > Smooks Run Configuration. If your Smooks configuration is correct, the console displays the results according to the input model and output model you specified.
You can now add the Smooks configuration artifact to a proxy service or sequence to use it in the ESB. To do so, create a proxy service. Drag and drop a Log mediator and a Smooks mediator to the InSequence. Double-click on the Smooks mediator to see the Property view. Click the button at the right hand corner of the Configuration Key field.
The Resource Key Editor dialog box appears. Specify from where you should select the resource file.
Select Workspace option since we have the created Smooks Configuration in our workspace. Browse for the Smooks Configuration file that we have created and click OK.
Now you have successfully referred to the Smooks configuration within your proxy service.
Moving ESB artifacts between projects
To move an ESB artifact from one project to another, right-click on the artifact (in this instance, Sequence123.xml
), click Move and then select the folder to which you want to move the artifact. It is also possible to simply drag and drop the artifact.
Deploying the ESB Config project
Once you create all the ESB components such as sequences, proxy services, endpoints, local-entries, you can create a Composite Application Project to group them and create a Composite Application Archive. Before creating the CAR file, make sure that the server role is set to EnterpriseServiceBus.
For more information, see Packaging Artifacts into Composite Applications.