1
votes

what is the fastest way do deploy a class Mediator on ESB?

I have my custom mediator in eclipse and every time I extract the project as a JAR file and put it in "ESB\repository\components\lib" but it does not commit the changes every time...

it looks like ESB still use an old verion of my custom mediator.

Please suggest

EDIT: also to have the last version deployed I need to delete all the files in the "dropins" folder

3

3 Answers

3
votes

The fastest way I would suggest (With Developer Studio 2.0.1):

  1. Create the mediator project
  2. Create a Carbon Application Project and include the mediator project in C-App project as a C-App artifact
  3. Export the C-App project and get the CAR file
  4. Deploy the CAR file in C-App deplopyment folder(/repository/deployment/server/carbonapps)

** No need to restart the Server or delete existing Jars in the components/lib location or components/dropins location

The fastest way I would suggest (With Carbon Studio 1.0.14):

  1. Export "Carbon application project" as a CAR
  2. put the CAR in /repository/deployment/server/carbonapps

** No need to restart the Server or delete existing Jars in the components/lib location or components/dropins location

** When you update the existing mediator, replace the existing CAR file in the C-App dpeloyment location with the new CAR and restart the server

Harshana

2
votes

You can create your custom mediator project using Developer Studio (previously known as carbon studio) and then include your mediator logic in that class mediator project[1]. Then create a C-App project in Developer Studio which includes your Class mediator as a C-App artifact[2].

Once you export this C-App project,you will get a CAR file which contains your Class mediator[3]. Once you deploy this CAR file in the ESB, it will automatically deploy the Class mediator OSGi bundle in the ESB and you can use the class mediator right away.

When you update the class mediator logic you can re-export the C-App project and simply replace the existing CAR file in the ESB with the new CAR file. Then your previous class mediator OSGi bundle will be removed from the ESB. But due to an limitation in the Equinox OSGi implementation you won't be able to use the new version of the class mediator until you restart the server.

So all you need to do is, replace the existing CAR file with the newer version of the CAR file and restart the ESB server. ESB server will take care of the deployment of OSGi bundle in to the system.

Since we have implemented support to deploy C-App to Carbon Server via Eclipse itself [4], you can use that approach as well. What you need to do is, add the ESB server to Eclipse instance and deploy the C-App which contains the class mediator via Eclipse itself. When you follow that approach you can update the logic in the class mediator and redeploy the newer version of the CAR file to server via Eclipse [5].

It is even possible to debug your Class mediator inside Developer Studio by following the guide in [6].

[1]. http://wso2.org/project/developer-studio/2.0.1/docs/server_extensions_category.html#CustomMediator

[2]. http://wso2.org/project/developer-studio/2.0.1/docs/packaging.html#Distribution

[3]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#CarGen

[4]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#Deploy

[5]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#Redeploy

[6]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#debug

Hope this helps!

Harshana

2
votes

The fastest way I found so far is:

  1. Export "Carbon application project" as a JAR
  2. put the jar in WSO2_ESB\repository\components\lib
  3. delete the relative jar in WSO2_ESB\repository\components\dropins
  4. restart ESB