Tuesday, November 16, 2010

PhD here I come

I decided to officially start my PhD dissertation.

My primary research area can be summarized as improving reusability and repeatability of the middleware solutions based on the Open Source Java software. I'm particularly interested in the solutions based on the Apache ServiceMix stack i.e. Camel, CXF and ActiveMQ.

I started my PhD-oriented portfolio here. It's intended to summarize my progress in the PhD research.

Wednesday, October 13, 2010

Camel Enterprise Integration Patterns - Message Channel

Hophe and Woolf distinguish six types of Messaging Systems Patterns. The first of them is Message Channel.
  • it is medium defining how application communicate with another
  • it can be located using logical address
  • it can hide complex messaging infrastructure (proxy, facade)
  • it is usually configured at the deployment time
  • set of well orchestrated channels == ESB
Good examples of Message Channels are:
  • JMS queue/topic
  • files located on file system
  • SQL tables
  • HTTP/SOAP connection with Web Service
Camel doesn't provide public implementation of Message Channel pattern. Details of channels implementation are hidden behind the Endpoint facade.

Thursday, October 7, 2010

Released db4o component for Camel

I contributed db4o component for Apache Camel. It is hosted under Camel-Extra Project, like all *GPL-related Camel components.

New component allows you to use a db4o datastore as a logical queue. Consumers take messages from the db4o store and then delete them to logically remove them from the queue. On the other hand sending POJO object to the db4o endpoint adds and saves object into the database. Detailed usage is described in the reference documentation.

Enjoy.

Monday, September 27, 2010

Custom XStream driver configuration added to Camel XStream data format

Apache Camel provides support for XStream data transformation. However until now it was very difficult to provide XML pull parser driver different then default XppDriver. Few days ago I created patch for Apache Camel XStream data format (with help from Willem Jiang with hacking Spring DSL for it). My improvment has been submitted to the Camel codebase. It should be included in Camel 2.5 .

Now you can pass reference of the HierarchicalStreamDriver instance directly in the Spring DSL with driverRef attribute:

<bean id="jsonDriver" 
class="com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver"/>

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
  <dataFormats>
    <xstream id="xstream" driverRef="jsonDriver"/>            
  </dataFormats>

  <route>
    <from uri="direct:start"/>
    <marshal ref="xstream"/>
    <to uri="mock:result"/>
    </route>
</camelContext>

Friday, September 24, 2010

Camel supports field omitting for XStream data format

I committed patch to the Apache Camel XStream data format. It provides support for omitting selected fields. Claus Ibsen added Spring DSL to it and now it's ready to go to the next version of Camel (2.5).

Omitting selected fields is an useful option of XStream. By default XStream includes all fields of the object in the XML (un)marshalling process. Method XStream.omitFields() configures XStream to ignore selected fields for given class and not taking them under consideration during the XML (de)serialization process.

Here is the sample usage with Camel:

<camelContext xmlns="http://camel.apache.org/schema/spring">

  <dataFormats>
    <xstream id="xstream">
    <!-- omit the qux field from the Bar class -->
      <omitFields>
        <omitField class="foo.Bar">
          <field>qux</field>
        </omitField>
      </omitFields>
    </xstream>
  </dataFormats>
  
  <route>
    <from uri="direct:start"/>
    <marshal ref="xstream"/>
    <convertBodyTo type="String"/>
    <to uri="mock:result"/>
  </route>

</camelContext>

Tuesday, September 21, 2010

How to find desired Maven archetype?

To search for the Maven archetype you need, display list of all available ones from of the selected catalogs:

hekonsek@jorge:/tmp$ mvn archetype:generate -DarchetypeCatalog=internal,remote,local | grep -i camel
47: remote -> camel-component (null)
48: remote -> camel-router (null)
49: remote -> camel-archetype-activemq (Creates a new Camel project that configures and interacts with ActiveMQ.)
50: remote -> camel-archetype-component (Creates a new Camel component.)
51: remote -> camel-archetype-java (Creates a new Camel project using Java DSL.)
52: remote -> camel-archetype-scala (Creates a new Camel project using Scala DSL.)
53: remote -> camel-archetype-spring (Creates a new Camel project with added Spring DSL support.)
54: remote -> camel-archetype-war (Creates a new Camel project that deploys the Camel Web Console, REST API, and your routes as a WAR)
98: remote -> servicemix-camel-service-unit (null)

Now you can execute Maven in interctive mode and enter id of the desired artifact:

hekonsek@jorge:/tmp$ mvn archetype:generate
...
Choose archetype:
...
Choose a number: 80: 98
Choose version: 
1: 3.2
2: 3.2.1
3: 3.2.2
4: 3.2.3
Choose a number: : 4
...
Define value for property 'groupId': : foo
Define value for property 'artifactId': : bar
Define value for property 'version': 1.0-SNAPSHOT:
...

Ta-da! Project from archetype is ready to go.

Monday, September 20, 2010

Types of Maven archetypes catalogs

Maven Archetype plug-in allows to publish available archetypes using the catalogs. To be exact four kinds of archetype catalogs are supported:

By default Archetype plug-in (Maven 2.2.1, Archetype Plug-in 2.0-alpha-5) uses local and remote repositories to list available artifacts. You can specify catalogs to use with -DarchetypeCatalog option:

mvn archetype:generate
-DarchetypeCatalog=internal,http://foo.com/archetype-catalog.xml