Monday, 21 February 2011

Back from Italy

It was a lovely week end to visit my parents and my friends and to take care of my apartment.


Aggiungi didascalia
Aggiungi didascalia
Aggiungi didascalia
Aggiungi didascalia
Aggiungi didascalia

Monday, 18 May 2009

Aapche ServiceMix: an example with Camel

After the Open Community Day in Rotterdam, last week I need to rewirte a piece of our workflow with Camel. As James suggested me I could use Camel whenever I don't need to have each single state of the workflow persisted into the database. And this is exactly our case... 
So  here we go... and here some step on doing this.

Problem: 
As in the Order File Processing Workflow in the Service Mix documentation I'll try to create a simple workflow that manages an xml file with an order, picking the file up from a given directory, send it to the Camel endpoint that will process it and write it back to another given dir.

To do this I need 3 endpoints: 
  • the Poller endpoint: it will poll on the given dir to check if there is a file
  • the Process endpoint: managed by Camel, it will receive the xml of the order and it manages the changes on the order xml
  • the Writer endpoint: another file endpoint that is in charge of writing the file on the given destination directory.
So let start creating the service unit that will contain the configuration and some code.
I need 3 SU (SMIX ServiceUnit), even if the poller and the sender could be configured in the same SU. But to enable more reuse of an endpoint is better configure 3 SUs:

I'll use a dir in which I'll create all 3 SUs. This dir will be called project_home, later on I'll add a pom.xml in there to group all the SU and the SA (Service Assembly). In this way is possible to manage in one shot the whole project. here ther references to all possible Maven archetypes
I refer to this directory as $project_home.

Create the File-Poller-Su:
mvn archetype:create \
 -DarchetypeGroupId=org.apache.servicemix.tooling \
 -DarchetypeArtifactId=servicemix-file-poller-service-unit \
 -DartifactId=tutorial-file-poller-su
Create the Camel-Su:
  mvn archetype:create \      -DarchetypeGroupId=org.apache.servicemix.tooling \      -DarchetypeArtifactId=servicemix-camel-service-unit \      -DartifactId=tutorial-process-su
Create the File-Writer-Su:
mvn archetype:create \
 -DarchetypeGroupId=org.apache.servicemix.tooling \
 -DarchetypeArtifactId=servicemix-file-sender-service-unit \
 -DartifactId=tutorial-file-sender-su
Now we can define the configuration of the poller, the sender and the Camel process.
Modify the xbean.xml under the ...-file-poller-su
Modify the camel-context.xml under the ...-process-su
Modify the xbean.xml


Wednesday, 12 November 2008

Maven 2.0.9 + Sping 2.5.5 a useful note

I'll start from here... even if is not the best way... but it's usefull for me and I hope even for somebody else.

I'm preparing an POC for my Company UPC (www.upc.nl) in which I use Spring (v.2.5.5), Maven (v.2.0.9), Apche CXF (v.2.2) and Hibernate.
I'll surely later add some more details about how to prepare a Maven project from scratch but now it is important fix this issues that I have had ... and because my memory is getting wrong (probably I need a defrag :-) ) this could be a nice place.

So arrive to the nut:
I compile successufully with
mvn -U -up clean install
but when I have done 
mvn -U -up jetty:run 
I've got the following error:
Embedded error: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/tx]
Offending resource: file [C:\java\...\...\applicationContext.xml]

So after some check on google I've found I have missed one of the dependency.
The dependency missed:
     org.springframework
     spring-tx
     2.5.1

After put that into the pom... it compiles succefully !  Prima! the dutch will say! :-)