Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Roadmap for a perspective Servicemix developer

THE POINT:

  • connect the dots between the documentation already existing on the Servicemix website
  • Give a developer interested in Servicemix a run through on getting the software up and running
  • Give the developer instructions on compiling/installing the packaged Smix examples
  • Give the developer information on monitoring/configuring the software via jconsole
  • Create two working service assemblies (SA's) which work together, using out of the box Smix components!

Also...

Check out Hello World - SE, a tutorial in progress on creating a simple service engine (JBI component) using tooling (mainly Maven archetypes).

Conventions:

TERMS:

  1. 'company repository' = a remote Maven 2 repository used within your company to hold dependencies/artifacts.
  2. Wiki Markup
    \[Smix_source_folder\] = the location of the folder created after uncompressing the downloaded Smix source distribution (from .zip, .tar.gz etc.).
  3. Wiki Markup
    \[Servicemix_binary_distribution_home\] = installation location of the Smix binary distribution on your machine

...

  • You will need Maven 2.0.4 or greater installed on your machine

Getting the component dependencies into your local machine/company repository

If you are going to be running any of the examples or doing any development with a current SNAPSHOT/release then you may want to do a few things first. It makes sense to check out the 3.0 (SNAPSHOT if you want the newest) source code so that you can install the Smix component dependencies in your local repository. First go here and download the ServiceMix 3.0 sources. Next you will want to build the Servicemix app and it's included components. Go to Building for instructions.

...

Info
iconfalse
titleGetting the Smix dependencies into your company repository

Wiki Markup
If you want to deploy those dependencies to a company repository then keep reading. I can only give information on doing this for Maven 2 as I did not try this for Maven 1. First go into the top level project pom.xml with you favorite editor. This will be in the \[Smix_source_folder\]/src folder. You are going to first edit out the references to Maven 1. Search for 'm1', or in another case I searched for 'maven-one'. There was a property and a plug in section I deleted (maybe some other sections also). I think the plug in is the important one to delete/coment out. Next edit the 'distributionManagement' section. Put the relevent information for you company repository here. If you are working with a SNAPSHOT release then you will need to put your snapshot repository information in here.

You should now be able to 'mvn -Dmaven.test.skip=true deploy' and the dependencies will upload to the remote repository you defined. This is a good thing when people you are working with will need the Smix component dependencies. If others will be working on a Smix project you create it will also come in handy, as they will not have to chase down dependencies. THANKS MAVEN!!! I think there are other benefits too, such as faster fetching since the dependencies are more local (physically).

Next up install the compiled binary Servicemix...

Wiki Markup
You now have Smix built from source, and the Smix components in a Maven 2 repository. The built distribution of Smix will be in \[Smix_source_folder\]/apache-servicemix/target. There will be a source distribution that is like (exactly like?) the one which you downloaded, and the .zip, .tar.gzip binary distributions. Install the binary distribution following the source installation instructions for [Windows|SM30UG:3. Installation#Windows Source Installation] respectively [Unix|SM30UG:3. Installation#Unix Source Installation]. Once you have installed the binary Servicemix installation you are ready to do some testing.

wsdl-first

Wiki Markup
The first thing to do now is install the [wsdl-first|SM30UG:1. Quick start#Deploy a sample application] service assembly (SA) which contains a few service units (SU's) ([see JBI specification document|https://sdlc6a.sun.com/ECom/EComActionServlet;jsessionid=728961EE41294F2FB2547B82D037F02E]). The end result is a XFire based SOAP service which is pretty simple. The actual code for the service is in the file \[Servicemix_binary_distribution_home\]/examples/wsdl-first/wsdl-first-jsr181-su/src/main/java/org/apache/servicemix/samples/wsdl_first/PersonImpl.java. Phew\! Take a look at the code, it is pretty simple. It uses an [annotation|http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html] which describes the class as a [jsr181|http://dev2dev.bea.com/webservices/jwsm.html] web service. One interesting thing to note about this project is the use of an ant task inside the parent pom.xml. This task uses XFire's WsGenTask to create Java objects used by the web service, as described in the WSDL file.

...

Wiki Markup
You are ready to rock. Change directory to the wsdl-first-sa module. Type 'mvn jbi:projectDeploy'. You can watch the Smix console for information on the deployment.!wsdl-first-install.jpg|align=center!
 
Betting that all went well you should be ready to test out the web service you deployed into Smix. Lucky for you a nice little web app has been packaged with the application. In your web browser open the file \[Servicemix_binary_distribution_home\]/examples/wsdl-first/client.html. This static .html page contains a javascript which will try to contact the web service on your local machine. To make it work simply click the 'send' button. If your browser issues any warning make sure you allow the javascript to do what it needs to do. In Firefox I have to 'allow' what it calls an unsafe operation. The results of clicking the 'send' button will be a SOAP response posted into the right hand text area.

Temporary excursion into monitoring

One great benefit to JBI and Smix are the monitoring capabilities. Using the jconsole application packaged with the Java SDK you can tap into your Smix instance. In doing so you can get all sorts of information on things like thread and memory usage, and have the ability to configure the Smix environment dynamically. Lets use jconsole! Open a terminal session and type 'nohup jconsole &'. If your machine has the Java SDK's /bin folder in it's path then this should launch the jconsole application. If the application has launched then you should be able to close the terminal window now.

...

  • Select the tab called 'MBeans'.
  • This gives a tree like structure that you can navigate through.
  • Open the node labeled 'org.apache.servicemix'. Open the 'servicemix' node.
  • Open the node labeled 'Endpoint'. You will see all the installed endpoints in your JBI environment here. There should be only one.
  • You should see a node labeled 'ServiceAssembly', open this node. You now should see one entry for wsdl-first. Click on this entry. The window to your right should now pop up some information about the SA.
  • In the right window click on the tab labeled 'Operations'. You will see four operations: start, stop, shutdown, and getDiscriptior.
  • Click the shutdown button. You will get a pop up window containing XML that tells you how the operation went. I hope that you see SUCCESS in the task-result element.
  • With the SA shutdown try to get the WSDL and use the client.html app to contact the web service. Niether will work.
  • Let us start the SA again, click the start button in the operations window. You again get a pop up with XML.
  • Try again to get the WSDL or hit the web service using the client.html app. Both should now work.
    So this is brief but should give you a good idea of how easy it can be to manage your Servicemix instance(s).

Next up - the bridge example

coming soon....