A Look Inside FUSE ESB 4: An OSGi-Based Integration Platform

Listing 9 The InsuranceRouter implementation which talks with the file poller and sender.

package com.fusesource.camel;

import org.apache.camel.builder.RouteBuilder;
public class InsuranceRouter extends RouteBuilder {
public void configure() throws Exception {
from("jbi:service:http://fusesource.com/examples/jbicamel/insuranceCamelRouter")
.to("log:showAll?level=info")
.to("jbi:service:http://fusesource.com/examples/jbicamel/insuranceFileService");
}
}

In the from method we can define a JBI service address, which enables JBI components, such as the file poller in this example, to send messages to this InsuranceRouter. Notice that you need to define the fully qualified service name, including the namespace and the service name. In this example, we log the incoming message and sent it to the insuranceFileService JBI service. This is, of course, the file sender we defined in listing 8.

To get this example running, we first need to install several components on the container using the features install command. Execute the following commands to install the necessary components:

features install jbi

features install servicemix-shared

features install servicemix-file

features install servicemix-camel

Now we can build the OSGi bundle. The jbi-camel-test project structure is similar to figure 4, so we can build the OSGi bundle using Maven with the mvn clean install command. In the target directory of the project the jbi-camel-test-1.0.jar is then created, so this file can be copied to the deploy directory of the FUSE ESB 4. Now you can trigger the example by copying the insurance-request.xml message to the insuranceIn directory created in the root of the FUSE ESB installation. This file is moved to the insuranceOut directory and the message content is logged to the FUSE ESB container. You can look at this log file with the log display command in the console.

Conclusion

In this article we’ve shown the new architecture of FUSE ESB 4 and the new capabilities this brings for developers. The new FUSE ESB console provides a nice management tool to interact with the container. And the provisioning component provides a really flexible way to install and remove components from the container, so you can create the ESB you need in your environment. The integration with Maven is really helpful to developers.

We looked at two main deployment models with the Spring XML configuration file and OSGi bundle in several examples. In the examples we showed that the role of Camel is pretty dominant in FUSE ESB 4 and this makes implementing routing logic very easy. You can choose if you want to define this logic with XML configuration or the Java DSL.

And of course we can still use JBI within FUSE ESB 4, so we can reuse the JBI components that are already available in FUSE ESB 3. You can choose to use OSGi bundles with a single configuration file or a service assembly consisting of several service units.

I hope you enjoyed this introduction into FUSE ESB 4 and working with the given examples. I really think the new OSGi bundle deployment model and the ease to configure Camel routes and CXF services is a step forward. FUSE ESB 4 is ready to be used and should ease your life as an integration developer. Keep integrating!

Additional resources

1. Fuse ESB – http://fusesource.com/products/enterprise-servicemix4/

2. ServiceMix 4 – http://servicemix.apache.org/SMX4/index.html

3. Fuse website – http://www.fusesource.com

3. Enterprise Integration Patterns – http://www.enterpriseintegrationpatterns.com

4. Apache Camel – http://activemq.apache.org/camel

5. Download article source code – http://www.esbinaction.com/files/osgi_article.zip

Tijs Rademakers

Tijs is a software architect working for Atos Origin and specializing in enterprise integration. Tijs is the co-author of the Manning book “Open Source ESBs in Action” (http://www.manning.com/rademakers). He speaks frequently at Java conferences about open source enterprise integration projects like ServiceMix, Mule, Apache Synapse and Apache Tuscany.

0
Average: 4.8 (6 votes)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

davsclaus replied on Wed, 2009/03/11 - 12:57am

Very nice article.

Maybe the description for the Camel SEDA and VM components, could be changed to:
- asynchronous call to another endpoint in the same Camel Context
- asynchronous call to another endpoint in the same JVM

The List component is renamed to Browse in Camel 2.0 as a better name what it does, eg being able to browse Messages that have passed it.


--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

davsclaus replied on Wed, 2009/03/11 - 1:03am

I am wondering if in listening 3 the reference for the connectionFactory should be pooledConnectionFactory instead? Well at least you would assume this when reading the AMQ configuration below.

davsclaus replied on Wed, 2009/03/11 - 1:06am

ActiveMQ comes with a web console, I was wondering if that is can be used for sending new messages to a JMS queue instead of having to install Hermes and find out how to get it connected with AMQ.

AMQ web console:
http://activemq.apache.org/web-console.html

trademak replied on Wed, 2009/03/11 - 2:24am

Hi Claus, Thanks, I changed the VM and SEDA description to your descriptions. About listing 3, the pooledConnectionFactory ref attribute value is pointing to the Spring bean definition in the activemq-broker.xml file. So the name I gave the JMS ConnectionFactory in listing 3 is just a name that's used within this FUSE JMS configuration. And yes, the web console can of course also be used to send a message to a JMS queue. Hermes is a nice alternative with some more features. Best regards, Tijs

ty_780823 replied on Sat, 2009/03/14 - 9:21am

Hi trademak,

The same greate and wonderful article as "Open-Source ESB In Action"!

I wish that you can contribute more excellent article about enterprise integration.

Especially about the key technoledge points of open source integration(such as spring with mule,spring with servicemix,...).



--- Mike Tang

Sun Glassfish FishCat Contributor

Open Source Integration Fans



Blog: http://mikertang.blogspot.com/

trademak replied on Sat, 2009/03/14 - 11:51am in response to: ty_780823

Hi Mike, Thanks! I have plans to write some more articles about open source integration (as time permits). Best regards, Tijs

Robert Williams replied on Wed, 2009/03/18 - 7:42am

Could not  download the article source code at  the URL listed.

Could you please make the article source code available

BTW Nice article! 

teseling replied on Wed, 2009/03/18 - 8:12am in response to: rjwil35

I would also like to download the source, could you provide an updated link?

trademak replied on Wed, 2009/03/18 - 2:52pm in response to: teseling

Hi, I've added the source code to my own web page at esbinaction.com. I changed the download link in the article. Let me know if you still run into problems. Best regards, Tijs

teseling replied on Wed, 2009/03/18 - 5:39pm in response to: trademak

Thanks a lot. I still had some problems with the correct pom.xml settings in order to gets things working, but with the source I managed to get it working!

emad964 replied on Mon, 2009/06/29 - 4:35pm

تحميل برامج برامج جوالات العاب بنات برامج تكنولوجيا كتب تعليم UltraSurf العاب برامج نت Internet Download Manager ProgDVB برامج مجانية أفضل المواقع العربية دليل مواقع مشاهدة محطات مشفرة Online TV Player 3.0.0.940 Internet Download Manager 5.17 Build 4 رقص شرقي anyTV Pro 4.32 OnLineLive 7.1.1 هزي يانواعم ProgDVB 6.06.2 SopCast 3.0.3 منتدى برامج نت Falco Image Studio 3.6 لعبة تزلج على الجليد UltraSurf 9.4 كاثرين هيغل Katherine Heigl محطة غنوة FreeZ Online TV 1.0 Free Video to Mp3 Converter 3.1.3.51 Advanced MP3 Converter 2.10 Xilisoft Video to Audio Converter 5.1.23.0515 Blaze Media Pro 8.02 AKRAM Media Creator 1.11 DVD Audio Extractor 4.5.4 Free WMA to MP3 Converter 1.16 لعبة نينجا المتقدم لعبة قذف كرة لعبة دراجات البهلوانية لعبة اعداء الغابة تحميل برامج Download DivX Subtitles 2.0 BullGuard 8.5 Google Chrome 2.0.181.1 Dev Dell Studio XPS Desktop 435T Intel Matrix Storage Manager A00 Gigabyte GA-EP45-UD3P Bios F9 Ambush HDConvertToX 1.1.229.1764 MSI Wind Nettop CS 120 Realtek Audio Driver 5.10.0.5618 Biostar T41-A7 6.x Realtek On-Board Audio Driver 5.10.0.5735 for 2000/2003/XP TweakNow RegCleaner 4.1.1 SpeedItup Free 4.97 برامج العاب - Internet Download Manager - برامج جوالات - العاب - محطة غنوة - قنوات فضائية - بنات - تكنولوجيا - كتب تعليم - UltraSurf - ق ذ -0

jiji530 replied on Tue, 2009/06/30 - 12:21am

thanks for your post.perhaps you will like abercrombie ed hardy mortgage rates tiffanys ed hardy Is not it?

Sandra Hong replied on Wed, 2009/07/29 - 12:19am

Nike Dunk a nice tool.

Xiamenlqy replied on Sat, 2009/09/05 - 4:17am

thank you fro share, by nike air max 90 shoe

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.