You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

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 (with examples!)
  • Give the developer information on monitoring/configuring the software via jconsole

Conventions:

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

  3. [Servicemix_binary_distribution_home] = installation location of the Smix binary distribution on your machine

NOTE: I am using apache-servicemix-3.0-incubating-20060907.104512-15-src.tar.gz for the following tutorial. If you do not use this snapshot release I cannot guarantee the following will work.

BEFORE STARTING:

  • You will need Maven 2 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 here for instructions.

Once you have built the 3.0 app, following the instructions linked above, the Smix component modules will be installed locally. 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 delte/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...

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 these directions. Note those are for Unix, but you can follow the link and find directions for Windows. Once you have installed the binary Servicemix installation you are ready to do some testing.

 wsdl-first

The first thing to do now is install the wsdl-first service assembly (SA) which contains a few service units (SU's) (See JBI specification document). 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 which describes the class as a jsr181 web service. One interesting thing to note about this project is the use of an ant task inside the parent pom.xml. This taks uses XFire's WsGenTask to create Java objects used by the web service, as described in the WSDL file.

So let's get this up and running in our Smix container. Start Smix, watch the output to make sure things start up correctly. You will need to open up a new console for the next step, since the Smix output is taking up the other. You will be able to watch this output to see what is going on in some of the following steps. Go back to [Servicemix_binary_distribution_home]. You need to copy the components needed by the wsdl-first SA from the /components folder to the /install folder. The ones you should copy are:

  • servicemix-http-3.0-incubating-SNAPSHOT-installer.zip
  • servicemix-shared-3.0-incubating-SNAPSHOT-installer.zip
  • servicemix-jsr181-3.0-incubating-SNAPSHOT-installer.zip

With each copied component will come messages from Smix in the console output window. Watch these to make sure things properly install. If any problems crop up, try to copy the component again. I have received a zip related exception before. I did the copy a second time and the problem didn't show itself a second time.

There is an easy way to do the following: copy the file [Servicemix_binary_distribution_home]/examples/wsdl-first/wsdl-first-sa-3.0-incubating-SNAPSHOT.zip into the /install folder. Watch the Smix console window making sure things go well. You can now open a browser and go here to see the WSDL for the SOAP service.

 That was the easy way....but you want to learn about developing so let's do it the 'hard' way. First go to the [Servicemix_binary_distribution_home]/examples/wsdl-first folder and type mvn install. This example project is using a Maven 2 plugin for creating specific JBI components. If you look in the module pom.xml files you will see a special packaging type. After the mvn install completes there will be file called wsdl-first-sa-3.0-incubating-SNAPSHOT-installer in the wsdl-first-sa module's target folder. This is SA for the wsdl-first example project. Now we want to deploy this to our container. The Maven JBI plugin will take care of this for us!!! Note we need to make a small change to the wsdl-first-sa module's pom.xml. The plugin will normally try to install all the shared libraries needed by the SA when running the Maven goal jbi:projectDeploy. This is sometimes useful. But often it causes problems because another SA in Smix is using the shared lib already. In this case the Maven goal will try to remove and redeploy the shared lib from Smix. This causes a problem and will make the SA deployment fail. So to tell the plugin to not do this make the following change in the pom.xml:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>jbi-maven-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

---to--- 

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>jbi-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <deployDependencies>false</deployDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

 That little config change will prevent some headaches later.

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.

Temporary excursion into monitoring

coming soon... 

Next up - the bridge example

coming soon....

  • No labels