Java dsl vs Blueprint

Recently I was thinking whether it would be good to stick to either the purse Java dsl or the blueprint one, especially when deploying to the Karaf environment.

One of the good things about the blueprint xml is that it makes the OSGI stuff much easier to handle since Karaf can work well with blueprint so there is no need to OSGI:fy your code.

One the other hand, the java dsl is simply easier to work with and most of the documentation is for the java dsl so you will find more help. Also, who knows, in 5 years maybe blueprint will be replaced so the java dsl feels more safe.

So I was curious to know how other Camel users felt hence I put this question the Camel Nabble forum here:

http://camel.465427.n5.nabble.com/java-dsl-vs-blueprint-xml-td5775085.html

The consensus seemed to be that one could use Blueprint as a start-up mechanism to load the CamelContext and then build the routes, onexception and all other code in a RouteBuilder class which can be referenced via a bean.

I think this makes best use of both worlds. You use only blueprint for loading the routes and use java to build the actual routes and all the extra layers for logging and error handling. This way, if blueprint is replaced it only affects your loading and not the main routing part.

See example here:

https://github.com/cschneider/Karaf-Tutorial/blob/master/camel/jms2rest/src/main/java/net/lr/tutorial/karaf/camel/jms2rest/Jms2RestRoute.java

https://github.com/cschneider/Karaf-Tutorial/blob/master/camel/jms2rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml

There was a mention of the groovy dsl and I know there is a scala one as well. I haven’t used it and there is very little documentation on both so it is hard to learn quickly by examples but if anyone has used it feel free to comment on there ease of use.

Annonser

Kommentera

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut / Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s