camel-hibernate now has a mvn repo 0

Posted by dave
on September 03, 2008 @ 06:29 PM

A maven repo has been added to the camel-extra google code project, so its no longer necessary to build the camel-hibernate project from scratch. Yay!

In order to add the camel-hibernate plugin as a dependency of your camel project you just need to add the repo:
1
2
3
4
5
<repository>  
  <id>camel-extra-release</id>  
  <name>Camel Extra Maven repository of releases</name>  
  <url>http://camel-extra.googlecode.com/svn/maven2/releases</url>
</repository>
Then add the dependency for the hibernate component:
1
2
3
4
5
<dependency>  
   <groupId>org.apache.camel.extra</groupId>  
   <artifactId>camel-hibernate</artifactId>  
   <version>1.0</version>
</dependency>

(Thanks Joe for the heads up)

Tuning Message Bus performance in Servicemix

Posted by dave
on May 21, 2008 @ 10:21 PM

How fast you can send messages through ServiceMix is highly dependent on how the embedded ActiveMQ broker within ServiceMix is configured. This is because the ServiceMix NMR uses ActiveMQ as its messaging engine, so choosing the correct connection factories and persistenceAdapter can give you easy gains in performance.

AMQ Message Store

In ActiveMQ 5.0, a new high performance journaling persistence adapter was introduced called the AMQ Message Store.

To enable it, edit /conf/activemq.xml and modify the xbean config, adding the amq:persistenceAdapter element.
1
2
3
4
5
6
7
8
 <amq:persistenceAdapter>
         <!-- Goodbye journaledJDBC --> 
         <!--amq:journaledJDBC journalLogFiles="5" dataDirectory="./data/amq"/ -->

         <!-- Hello AMQ Message Store -->
         <amq:amqPersistenceAdapter directory="file://./data/amq"/>

 </amq:persistenceAdapter>

And by the numbers ..

Example Flow: Jms consumer -> JMS provider(w/Marshaller) -> EIP pipeline -> Bean -> JMS Provider MessageCount: 10000

   With JournaledJDBC:

   [java] Overall time: 137701 ms
   [java] Messages per sec: 7.262111386264443
   [java] 
   [java] Time: 139.603
   [java]
   [java] OK (1 test)
   With AMQ Message Store:

   [java] Overall time: 20511 ms
   [java] Messages per sec: 48.75432694651651
   [java]
   [java] Time: 23.556
   [java]
   [java] OK (1 test)

Two additional steps:

1) The current version of Servicemix trunk is using 4.1.1 of ActiveMQ, so if you want to build a ServiceMix distribution that contains ActiveMQ 5, you need to edit /trunk/pom.xml:

1
2
3
/trunk/pom.xml
-        <activemq-version>4.1.1</activemq-version>
+        <activemq-version>5.1.0</activemq-version>

2) Once the activemq-version is updated, the ra namespace in jndi.xml needs to be updated too - as this changed between AMQ versions.

/distributions/apache-servicemix/src/main/release/conf/jndi.xml
-       xmlns:amqra="http://activemq.org/ra/1.0"
+       xmlns:amqra="http://activemq.apache.org/schema/ra"

If your using Fuse ESB, it has a 5.x version of the Fuse Message Broker included, so the XML configuration change should be all thats required.

Deciphering a Servicemix Service Assembly build error

Posted by dave
on May 16, 2008 @ 12:36 PM
[INFO] The service unit my-jms-consumer-su does not have a dependency which is packaged as a jbi-component or a project property 'componentName'

If you see the above error when trying to build your servicemix service assembly, the trick is to look at the pom.xml for the component with the problem. In this case the ServiceMix SU is'my-jms-consumer-su'.

In order to fix the Service Assembly build error I added the componentName to the SU's pom.xml below properties section, so
1
2
3
        <properties>
                <servicemix-version>3.3.1.0-fuse</servicemix-version>
        </properties>
became:
1
2
3
4
        <properties>
                <servicemix-version>3.3.1.0-fuse</servicemix-version>
                <componentName>servicemix-jms</componentName>
        </properties>

This problem only tends to occur when you have multiple su's within the assembly that depend on the same servicemix component (e.g. servicemix-jms). Make sure you add the componentName to all of the Service Unit poms.xml's that use that component.

Using the Spring based JMS Endpoints in Servicemix

Posted by dave
on May 14, 2008 @ 05:07 PM

I've been running performance tests with Fuse ESB 3.3.1 and the spring based JMS endpoints over the last day or two.

One gotcha I've seen mentioned before with ActiveMQ is on the producer side you need to use a PooledConnectionFactory when using springs jmsTemplate. The same applies when using the Servicemix jms:provider endpoint (as its using jmsTemplate under the covers).

If your jms provider configuration looks similar to this:
1
2
3
4
5
6
7
8
9
10
11
 <jms:provider
      service="test:MySpringProviderService"
      endpoint="mySpringProvider"
      destinationName="queue/OUT"
      connectionFactory="#connectionFactory"
      pubSubDomain="false"
      stateless="false" />

 <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://localhost:61616" />
 </bean>

change the connectionFactory to something like this:

1
2
3
4
5
6
7
8
9
 <bean id="connectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
    <property name="connectionFactory">
      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616" />
      </bean>
    </property>
    <property name="maxConnections" value="1" />
    <property name="maximumActive" value="1" />
  </bean>

Then by the numbers for my test flow (Jms Consumer->EIP->Bean->JMS Provider & processing/10K worth of messages) ...

Pooled ConnectionFactory:
     [java] Overall time: 40360 ms
     [java] Messages per sec: 247.77006937561944
     [java] 
     [java] Time: 41.064
     [java] 
     [java] OK (1 test)
     [java]    
Non-Pooled ConnectionFactory:
     [java] Overall time: 908363 ms
     [java] Messages per sec: 11.008814757976712
     [java] 
     [java] Time: 909.34
     [java] OK (1 test)
     [java] 
 

Those couple of lines of XML make a big difference. Without the pool, the JMS connection is torn down each time and that accounts for the disparity.

A second area to look out for is the jms:consumer endpoint configuration. Make sure you set the cacheLevel to CACHE_CONNECTION (1) or CACHE_CONSUMER (3). The default is CACHE_NONE. Below we set the cacheLevel for the underlying DefaultMessageListenerContainer to CACHE_CONSUMER

1
2
3
4
5
6
7
  <jms:consumer service="test:MySpringConsumerService"
        endpoint="mySpringConsumer"
        targetService="test:MySpringProviderService"
        destinationName="queue/SPRING_IN"
        connectionFactory="#connectionFactory"
        concurrentConsumers="1"
        cacheLevel="3"/>
I hope these two tips will help you fine tune your Servicemix performance.

Building opensource web services using JAX-WS

Posted by dave
on April 03, 2007 @ 12:17 PM

Over on SOS Adrian has posted a set of slides that describe how to build multi-protocol, opensource, web services using JAX-WS.

The presentation gives a great overview of the architecture that allows Celtix Enterprise to deploy services that simulateneosly support multiple payloads (SOAP, XML, JSON) and transports (HTTP, JMS, AMQP). It also give some very helpful pointers on JAX-WS development in general - well worth checking it out.

Getting started with Apache CXF

Posted by admin
on October 27, 2006 @ 05:58 PM

Today I setup CXF, a new services framework project currently under incubation at Apache. CXF is the merging of the Objectweb Celtix project and the Codehaus XFire project. Its still early days for the project but if you check out the project goals you can get a good idea of the featureset that CXF will eventually offer. Today I just wanted to get as far as running a couple of the demos.

Installing:

CXF has external dependencies on JDK 1.5 and Maven 2.x. As there is no official release yet you need the build the project directly from the subversion repository. If you want to build the samples you will also need ant installed.

1. Install JDK 1.5 (approx 130MB)

The Sun download page has three different distributions, JDK with NetBeans IDE, JDK with JEE and just the straight 1.5 JDK. I just opted for your basic 1.5 JDK.

2. Install Maven 2.0.4(approx 1.15MB)

The Maven install is just a zip/gz file. You just need to download the zip and unzip it on your system. Then you need to add the /bin directory to your path.

>cd /x1/maven2.0.4
>wget http://www.apache.org/dist/maven/binaries/maven-2.0.4-bin.tar.gz 
>tar -zxvf maven-2.0.4-bin.tar.gz
>export PATH=/x1/maven2.0.4/bin:$PATH

On windows download the .zip version from the link above and use Winzip to unpack the zip. Then set the path as shown here.
>set Path=\bin;%Path%

3. Install subversion windows or unix (approx 11MB).

The windows link is to the subversion installer gui. This version of subversion uses BerkeleyDB 4.3. If you have any other applications on your system that might use a different version of BerkeleyDB (e.g Orbix), keep this in mind as you may see dll conflicts between the two versions. Once installed you should be able to run 'svn ?' from a command prompt and get a list of available svn commands.

4. If necessary install ant

Install is similar to maven, download and unzip to your system. Then setup the paths as shown:

>set ANT_HOME=c:\dev\ant
>set PATH=%PATH%;%ANT_HOME%\bin
>export ANT_HOME=/x1/ant
>export PATH=${PATH}:${ANT_HOME}/bin

Checking out the CXF source code:

To checkout the CXF source run :
>cd /x1/cxf
>svn co http://svn.apache.org/repos/asf/incubator/cxf/trunk

This is a good point to go and make yourself a cup of tea as this and the next step take some time.

Building the source code:

Once the source code is checked out, setup your environment so that java 1.5 is in your path. If you get this wrong you will see an error similar to this when you try and build with a JDK < JDK 1.5.

INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

Failure executing javac, but could not parse the error:
javac: invalid target release: 1.5

I also set things up such that my /bin directory was in the path. To build the project run:

>cd /x1/cxf/trunk
>mvn install

The first time you build CXF, maven will download what seems like an endless amount of dependency jars to a local maven repository on your machine. On windows this is below <> and on linux this was below <>. I have seen periodic download failures where maven fails to download a dependency but re-running mvn install tended to work the second time around.

Another thing to watch out for on windows is that there's a fair bit of shuffling going on in the CXF codebase right now. If the case of a file is renamed, svn on windows cannot detect this and this will leave you scratching your head as to why the project won't build. If you end up with a compile error that doesn't make sense try a 'mvn clean' and then a 'mvn install' and see if that fixes it.

Building the distribution snapshot:

Once the build completes you need to cd into the /distribution directory and run 'maven install' a second time to build a distributable version of cxf. This will produce a distribution with a samples directory which includes the 'hello_world' demo that we want to run.

>cd /x1/cxf/trunk/distribution
>mvn install
Installing the distribution snapshot:

The distribution build produces two distribution files (cxf-2.0-incubator-M1-SNAPSHOT.tar.gz and cxf-2.0-incubator-M1-SNAPSHOT.zip). Take the appropriate distribution and unzip it in a separate directory to the checked out code, for example:
>cp /x1/cxf/trunk/distribution/target/cxf-2.0-incubator-M1-SNAPSHOT.tar.gz /x1/cxf-distro/
>cd /x1/cxf-distro/
>tar -zxvf cxf-2.0-incubator-M1-SNAPSHOT.tar.gz

Now you have something you can test with.


Running the hello world demo:
>cd /x1/cxf-distro/cxf-2.0-incubator-M1-SNAPSHOT/samples/hello_world
>ant
>ant -projecthelp
Buildfile: build.xml

Main targets:

 build           build demo client and server
 client          run demo client
 client-servlet  run demo client hitting servlet
 server          run demo server
Default target: build
Now we run the server and the client
>ant server&

server:
     [java] Starting Server
     [java] Server ready...

>ant client

client:
     [java] Invoking sayHi...
     [java] Server responded with: Bonjour

     [java] Invoking greetMe...
     [java] Server responded with: Hello dstanley

     [java] Invoking greetMe with invalid length string, expecting exception...

     [java] Invoking greetMeOneWay...
     [java] No response from server as method is OneWay

     [java] Invoking pingMe, expecting exception...
     [java] Expected exception: PingMeFault has occurred: PingMeFault raised by server
     [java] FaultDetail major:2
     [java] FaultDetail minor:1
Enabling Logging:

So after running the demo, it looked like everything worked but there was not much to see. The next step for me was to enable some logging and get a peek at whats happening under the covers.

>cd /x1/cxf-distro/cxf-2.0-incubator-M1-SNAPSHOT/etc
>emacs logging.properties
See here for more details on configurable logging levels. I had to set both '.level' and 'java.util.logging.ConsoleHandler.level' in my logging.properties file to get logging output in my console.
.level= INFO
java.util.logging.ConsoleHandler.level = INFO 

I had to set the level to FINEST (very verbose!) to see the message going over the wire. Would be nice if this was logged at INFO level.

Thats about it for this time. Hope this article helps. If you spot any problems feel free to point them out.

The Role Companies Play on Wikipedia 0

Posted by admin
on October 14, 2006 @ 05:06 PM

Steve Rubel posted a podcast this week on the role public companies should play (if any) in providing content for wikipedia. As Steve highlighted previously, wikipedia has a LOT of influence. The wikipedia entry for a company can quite often be one of the most highly ranked pages in Google on a direct search for that company. The podcast primarily discussed the following dilemas:

1) What if there's no wikipedia entry? Assuming the company is sufficiently notable, is it ok for a company to create a space for itself on wikipedia?

It seems to me that as long as the article is purely factual, verifiable and presented with a neutral point of view then this would not violate the wikipedia NPOV policy.

2) What does a company do if it feels there is factually incorrect content about it on wikipedia?

Concensus here was that you go to the discussion tab associated with the article and prove the article is factually incorrect (using verifiable sources). Then leave it up to the community to do the rest.

3) What does a company do if there is negative but factually correct content about it on wikipedia?

Concensus here was that if the data is factually correct a company has no control over this and should not try to control it.

In some ways you can see how wikipedia can really create a headache for a companies PR firm and also why social content has the potential to be more disputed than more traditional factual entries.