Friday, November 20, 2009

New features for Apache Camel Bindy (non XML binding framework)

Today has been a very productive day. I have found the time to update the documentation about the Apache Camel Tutorial on OSGI and commit the last new features added to camel-bindy : the non XML binding framework used to parse or generate CSV, FIX, ... messages

This new version of bindy includes important new features like :
- Required (@DataField) to check mandatory field
- Position (@DataField and @KeyValuePairField) when the CSV/FIX message to be generate contain fields which are placed at a different position then those used to parse it
- Section which allow to define the class containing by example the header, body or footer section

and

- OneToMany which allow to :

  • Read a FIX message containing repetitive groups (= group of tags/keys)
  • Generate a CSV with repetitive data
More info can be find here.

LangDetecten>fr YahooC
OSGI

Monday, November 2, 2009

Tutorial part 1 about Apache Camel and OSGI (reviewed)

Last friday, I have spend some times to update the part 1 of the Apache Camel tutotrial. This tutorial shows how you can easily and quickly build and deploy a small SOA project using Camel 2.0 top of Apache Felix Karaf 1.0.0

The second part of this tutorial will be upgraded soon and will include a new section about integration tests with Pax Exam

Apache Camel Group on Linkedln

Apache Camel has now its Group on Linkedln web site : http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm

Feel free to join us to discuss / exchange ideas / news and jobs about your favorite mediation and router framework

Wednesday, October 28, 2009

Building OSGi applications with the Blueprint Container specification

Jarek Gawor which is an advisory software engineer for IBM and an Apache Geronimo committer /PMC member has published an interesting article on :

Building OSGi applications with the Blueprint Container specification

Wednesday, September 16, 2009

Fuse Community Day - Paris - 1st October

The first "Fuse Community day" will take place the 1st October 2009 in Paris. Different topics will be presented by the founders James Strachan, Rob Davies, Guillaume Nodet of the projects Apache Camel, ActiveMq and Karaf during this day.

To join the day, please register on this site : http://form.fusesource.com/forms/registerforParisDay

Here is the agenda :

09:30 - Réception et petit-déjeuner


10:00 - Ouverture de la conférence par Magali Briol


10:15 - FUSE et OSGi par Guillaume Nodet; Membre PMC

- La technologie OSGi est au coeurs des produits FUSE. Cette présentation vous permettra de découvrir OSGi, Apache Karaf, et leur utilisation au sein de FUSE ESB.“


11:00 - Enterprise Apache ActiveMQ par Rob Davies; Membre PMC et Co-fondateur

- Apache ActiveMQ is a the most widely used open source messaging system to date.

This presentation will look at deploying Apache ActiveMQ in the enterprise - for high availibity,

across wide area networks and how to tune Apache ActiveMQ to for performance

and scalability.


11:45 - Cas client par Sylvain Thomas; Architecte Capgemini

- Recueil de données satellites via FUSE ESB. Mise à disposition de Géo localisations et de

données règlementaires.


12:30 - Déjeuner


13:30 - Intégration avec Apache Camel par James Strachan; Membre PMC et Co-fondateur

- Apache Camel is a powerful open source integration framework based on Enterprise Integration Patterns with Beans Integration. This presentation will give an overview of Apache Camel and how to implement Enterprise Integration Pattern to solve a number of integration issues.


14:15 - Camel 2.0 et le développement de solutions orientées entreprise par

Charles Moulliard; Apache Camel Committer et Senior Enterprise Architecte

- Cette présentation va vous donner un aperçu des nouvelles fonctionnalités de Camel 2.0 et comment celles-ci vont aider les architectes/développeurs à construire des solutions orientées entreprises dans un environnement OSGI.


15:00 - Pause Café


15:15 - Intégrer JBI et OSGi avec ServiceMix4, JBI Components nouvelles caractéristiques et

roadmap par Jean-Baptiste Onofré ; ServiceMix Commiter

- Présentation des différentes versions de ServiceMix. Modularité au sein de ServiceMix4 (kernel

Karaf, NMR, composants). Publication de WSDL pour facilité l'utilisation des composants.“


16:00 - Introduction à FUSE Integration Designer par James Strachan et Rob Davies

- FUSE Integration Designer is an Eclipse tool design to help you create, debug and deploy your integration solutions for Apache Camel, ServiceMix and ActiveMQ.


16:30
-
Fermeture de la conférence

Friday, June 26, 2009

Don't Use System.out.println! but Log4j

Here is the bible when you want/need to configure Log4J. Thanks to Vipan Singla

Don't Use System.out.println!

Wednesday, June 24, 2009

OSGi Blueprint Services

In this very nice presentation of Guillaume Nodet, you will discovered what is magic behind OSGi Blueprint Services. This implementation who will be part of the next OSGI specification 4.2 will help the Java developer/architect to better design their solutions. The blueprint services are largely inspired from Spring Dynamic Module project but now it becomes a standard like EJB, ... in the past.


Tuesday, May 5, 2009

Apache Camel / OSGI / Wicket (real example - tutorial part2)

I have finalized a first draft of the second part of my tutorial about Camel 2.0 / ServiceMix-Karaf / CXF / OSGI / Apache Wicket

The purpose of the second part was to explain how to design a simple project where different concepts like :
  • persistence (Hibernate/spring),
  • routing (Apache Camel 2.0),
  • mapping between CSV file and objects (using camel-bindy),
  • webservices (Apache CXF - OSGI),
  • osgi stuffs,
  • packaging and deployment on Apache Karaf/ServiceMix OSGI server (features, PAX url),
  • web application integration (Apache Wicket, PAX Web)
have been addressed.

The tutorial has been designed in 4 parts :

  • Part 2a : real example, architecture, project setup, database creation
  • Part 2b : transform projects in bundles
  • Part 2c : add infrastructure and routing
  • Part 2d : web and deployment

and is available here : http://cwiki.apache.org/CAMEL/tutorial-osgi-camel-part2.html

Don't hesitate to provide me your remarks/comments to improve it.

Trick to pass an uri declared in a property file to a Camel route

Defining Camel uris in a file is not so easy. Until now, the only possibility was to create a camel endpoint where the uri was declared in the XML file.

Here is a trick who will simplify your life to declare/define the uri in a property file. Spring injection is used to replaced the variable declared in your XML file with the value discovered in the property file.

By example, to work with the following uri : file://d:/temp/data/?move=d:/temp/done/${file.name}

Remark : as you can see, the uri contains a variable to a Camel variable and in consequence is not a Spring bean. So we have to inform Spring that the variable to be searched in the XML file use another syntax delimiter (#{} instead of ${}).

Here is what you have to do

Step 1 : Create org.springframework.beans.factory.config.PropertyPlaceholderConfigurer bean

Define a PropertyPlaceHolder (using another prefix/suffix delimiter) to avoid conflict between your camel variable and Spring property



(1)
(2)
(2)


(1) : Define a different prefix instead of ${ which is the value by default and used as variable
(2) : Define the value of the suffix. In this case, this is the same as the default value

Step 2 : Create org.apache.camel.example.reportincident.routing.properties

Create the following file : org.apache.camel.example.reportincident.routing.properties and put it in your classpath. If you plan to deploy your camel route under Apache ServiceMix Kernel --> Apache Karaf, add this file in the META-INF/spring directory by example
Add the following property :

uriFile=file://d:/temp/data/?move=d:/temp/done/${file.name}

Step 3 : Create an endpoint in your Camel Spring DSL file

Create a camel endpoint for the uri that you would like to use



(1)

(1) As you can see, we use as a Spring variable reference the syntax #{} so spring will retrieve the value from the variable declared in the file

Step 4 : Adapt your route

Define the uri of your route like this :




Cool isn't !!

Wednesday, April 22, 2009

Camel Tutorial - OSGI part 1 (UPDATED)

I'm currently working on the part of the camel - OSGI tutorial part 2 but I have found the time to update the first part. This was required because I would like to use the maven PAX plugin instead of spring maven plugin and test it against SMX 1.1.0 and Camel 1.6.0.

The PAX maven plugin offers a lot of advantages regarding to the one of Spring (which is currently becoming a new tool called - bundlor)
- pom.xml file generated only include dependencies, plugin required,
- project can be designed with several modules,
- project can be tested with PAX Exam and launched using PAX runner
- ...

Here is the link to tutorial

Tuesday, April 21, 2009

Distributed OSGi – A Simple Example

Here is a very interesting article explaining what Distributed OSGI will looks like using implementation done by CXF project.

<coderthoughts />: Distributed OSGi – A Simple Example

Monday, April 20, 2009

ServiceMix 4 et son kernel OSGi (Xebia France)

L' excellente revue Xebia parle de ServiceMix et Service Mix Kernel.

Il est toujours intéressant de constater que des acteurs importants dans la vulgarisation des technologies clés dans les développements Java, ESB s'intéressent à ce projet inovateur, construit sur des fondations solides : Apache Felix, Spring DM et PAX et continue à séduire.

Tuesday, April 14, 2009

The power of Apache wicket and Spring OSGI Service top of ServiceMix 4

In a previous post, I have explained how you can transform ServiceMix 4 as a Web Application Server. In this new post, I will show you How you can combine the power of Apache Wicket and Spring OSGI services together on ServiceMix 4 with the help of PAX Web.

This mix can be achieved very easily. Only a few steps are required.

1) Create a maven project where you will design your spring service and expose it as an OSGI service according to the Spring documentation.






2) Create a new maven project that you will use to package your Apache web application. The trick here is to modify your web.xml file like this :

a) add listener and context parameter for the Spring OSGI Context Loader



b) Add Spring Factory to Apache (required to allow injection of dependency in java classes of Wicket)



Please refer to the Apache Wicket Web site for more info about Spring integration

3) create an applicationContext.xml file under WEB-INF folder containing the reference to the OSGI service :

<osgi:reference id="incidentService" interface="org.apache.camel.example.reportincident.service.IncidentService"/>

4) And of course, in your Wicket page, inject dependency using the Wicket annotation :

@SpringBean
private IncidentService incidentService;

5) Now generate the bundles (JAR/WAR) and deploy them top of SMX4. Before to deploy the war containing the web project, verify that the following bundles are deployed on SMX4 :

- OPS4J Pax Web - Web Container (0.6.0)
- OPS4J Pax Web - Jsp Support (0.6.0)
- OPS4J Pax Web Extender - WAR (0.5.1)
- OPS4J Pax Web Extender - Whiteboard (0.5.1)
- OPS4J Pax Url - war:, war-i: (0.4.0)

- spring-osgi-web (1.2.0.rc1)
- Wicket (1.3.5)
- Wicket IoC common code (1.3.5)
- Wicket Spring Integration (1.3.5)
- Wicket Spring Integration through Annotations (1.3.5)
- Wicket Extensions (1.3.5)

- Apache ServiceMix Bundles: jetty-6.1.14 (6.1.14.1)

A tutorial will be published soon with material and step by step.

Remarks :
- PAX-runner can be used as running environment (instead of Servicemix) with Equinox, Felix, ...
- Many thanks to Alin Dreghiciu (PAX project) for its help/support

Tuesday, March 31, 2009

What's new in ServiceMix 4

Rob Biresch has published an interesting post in dzone (SOA zone) about what is new in ServiceMix 4.

For more info, read its post and don't hesitate to vote on dzone

http://soa.dzone.com/news/whats-new-servicemix-4x

Monday, March 30, 2009

Trick to customize war deployment on ServiceMix4 using PAX

Here is another very interesting trick that you can use to customize the war the deployment process on ServiceMix.

customize = in this context, this word means How can I add property or extend existing of a MANIFEST file

e.g. : The WAR to be deployed contains tlb files created under the folder WEB-INF/tags/form and WEB-INF/tags/jms. By default PAX will create a MANIFEST file containing the property Bundle-Classpath with :
  • WEB-INF/classes
  • all jars from WEB-INF/lib directory
but will not take care about your folders

Two possibilities are available to tell to PAX that it must include in the Bundle-Classpath your folders

1) Command + uri

This one consists in to pass the parameters as an uri like this :

install war:file:///d:/temp/activemq-web-console-5.2.0.war?Bundle-Classpath= ., WEB-INF/tags/form, WEB-INF/tags/jms&Webapp-Context= activemqweb

2) Create a file.bnd + command

Another interesting option is to provide as a file the location of the WAR and the properties that you want to add
  • Create a file called xxxx.bnd
  • Add in the file the following lines :
WAR-URL=file:///c/temp/activemq-web-console-5.2.0.war
Bundle-Classpath=., WEB-INF/tags/form, WEB-INF/tags/jms
Webapp-Context=activemqweb
  • use in your favorite OSGI server (ServiceMix) the following command to install the WAR :
install war-i:file:///c:/temp/activemq-web-console-5.2.0.bnd

Friday, March 27, 2009

ServiceMix 4 as a Web Application Server

This week, I have discovered the web possibilities offered by the ServiceMix 4 platform. SMX ("pour les intimes") uses as its core platform the excellent packages of the project PAX which is the umbrella project for all OSGi bundles and tools.

In standard, the following bundles are installed :

[ 9] [Active ] [ ] [ 8] OPS4J Pax Logging - API (1.3.0)
[ 10] [Active ] [ ] [ 8] OPS4J Pax Logging - Service (1.3.0)
[ 11] [Active ] [ ] [ 5] OPS4J Pax Url - wrap: (0.3.3)
[ 12] [Active ] [ ] [ 5] OPS4J Pax Url - mvn: (0.3.3)

They are used to log information of the server and to install or wrap bundles. Nevertheless, PAX project is not limited to the mentioned bundles but proposes also Web support for jetty.

To install or transform ServiceMix as a Web Application Server, you can use the "web" and "web-core" feature (available under ServiceMix 4) or install the following bundles manually :

- OPS4J Pax Web - Web Container (0.5.2)
- OPS4J Pax Web - Jsp Support (0.5.2)
- OPS4J Pax Web Extender - WAR (0.5.0)
- OPS4J Pax Web Extender - Whiteboard (0.5.0)
- OPS4J Pax Url - war:, war-i: (0.3.3)
- Apache ServiceMix Bundles: jetty-6.1.14 (6.1.14.1)

The Web Application Server becomes available at the url http://localhost:8080.

Evidently, no jsp pages, servlets are available. Don't worry, to deploy a WAR, you only have to copy it to the deploy directory of ServiceMix and it will convert be converted as a bundle

By example, you can install a simple Hello World war using the command

install war:file:///d:/temp/sample.war?Webapp-Context=sample

remarks :
- file:/// must be changed according to the location of your war
- The parameter WebApp-Context is added to have a nicer web address

and see the result at the address : http://localhost:8080/sample/index.html

Yes, this looks beautiful but the web port number is 8080, my boss would like to secure the web site, change the session timeout, ....

This is very simple to do, you create a file named (org.ops4j.pax.web.cfg) and copy it in the directory etc of servicemix, in this file you can parametrize by example the following properties (see PAX for more information) :

org.osgi.service.http.port=80
org.ops4j.pax.web.session.timeout=10


You restart Servicemix and now the web site is available at the following address :

http://localhost/sample/index.html

Tuesday, March 17, 2009

Can Apache Camel be independent of the queuing engine ?

Designing and deploying an Apache Camel project in an environment where you have (as an administrator) the control is something very simple to do. Most of the time, the code that you will receive from the developers will be ready to be deployed on the server (ServiceMix, J2EE, ...).

But this is not the case, when you work in big companies where the infrastructure is separated from the teams in charge to design/build/deploy and release the application. As a developer you don't have access to the acceptance or production environment. This means that you must provide different configuration files to the builder team and/or release management in order to deploy your application in development, acceptance and production environment.

Obviously, the name of the servers are not the same and the infrastructure is in charge to manage the queues servers. In this environment, infra will never accept that the queues definition or creation of the queuing engine are under the responsibility of the developer(s). Thus, it will not be possible in your spring DSL file (or Camel Java DSL classes) to declare your queuing engine like this :

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
<property name="brokerURL" value="vm://localhost:61616" / >
</bean >

remark: vm://localhost:61616 must be changed to serverName.intranet.domainName:port
depending on queuing engine deployed in the different environment.

To make Camel independent of its queuing engine :
  • ActiveMq,
  • WebSphereMQ,
  • SonicMq,
  • TIBCO,
  • ...
and parameters like :
  • Size of the queue,
  • Size of the messages accepted on the queue,
  • Persistence of the messages
  • ...
you must made different modifications. Let's assume that you plan to use ActiveMq as your queuing engine. Here is the list of the modifications to do :

1) Add the required bundles to your ServiceMix 4 osgi server to allow it to work with ActiveMq. Normally, the features transaction and activemq are activated by default in the file etc/org.apache.servicemix.features.cfg. So, you don't have to do anything else except if you use ServiceMix Kernel. In this case, you have to add the bundles manually or add a link (in the config file) to the features.xml file where the bundles have been declared

2) Create a spring xml file where the parameters of the queuing engine are defined. Luckily, such a file already exists and is available from Apache ServiceMix 4 project. So, copy the file into the deploy folder of ServiceMix 4 or Servicemix 4 Kernel

3) Create a osgi-queueservice.xml file containing the following lines and copy it in the deploy folder of ServiceMix

<?xml version="1.0" encoding="UTF-8"? >
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

<bean id="active-mq" class="org.apache.activemq.camel.component.ActiveMQComponent" />

<osgi:service id="osgiqueuingservice" ref="active-mq" interface="org.apache.camel.Component"/>

</beans>

When the spring file will be at the server startup loaded by Spring (though its Application context), it will create the bean "active-mq" and instantiate the class : org.apache.activemq.camel.component.ActiveMQComponent.

Remarks :
- No parameters are provided to the ActiveMqComponent like brokerUrl, ...
- If you need to work with another JMS queuing engine, you can replace the class ActiveMQComponent by : org.apache.camel.component.jms.JmsComponent

Next it will create an OSGI service called "osgiqueuingservice" and expose it through the interfaces : org.apache.camel.Component

Remark : As JmsComponent, ActiveMqComponent implements this interface, the OSGI service is generic. So you could parameterized it using a property file (cfg file in the ServiceMix world)

4) The last step is very simple. In your camel config file, you add a reference to your osgi service in order to retrieve the queuing engine like this :

<osgi:reference id="queuingservice" interface="org.apache.camel.Component" />

Please remark that you import the Component interface. So, Camel becomes independent of the queuing engine used (WebSphere, TIBCO, ActiveMQ, ...)

and in your Camel route :

<camel:from uri="queuingservice:queue:in" />

Wednesday, March 11, 2009

How to share connection pool - OSGI- SMX4

Here is an interesting article published on the blog of Adrian Tranaman showing How to share a connection pool between OSGI bundle.

Friday, January 9, 2009

How to create OSGI bundles using PAX scripts

This following article(s) started to explore how PAX (see here for more information on PAX : http://wiki.ops4j.org/display/ops4j/Pax) scripts can be used with (or without) Spring DM
and help developer life to
  • create/modify OSGI bundles
  • deploy them in Equinox/Felix/...

How to create a Spring-DM bundle using PAX scripts - JQuantLib

http://aslamkhan.net/software-development/osgi-cookbook-1-a-simple-bean/