Enterprise Integration Zone is brought to you in partnership with:

Tijs has posted 3 posts at DZone. View Full User Profile

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

03.10.2009
| 96232 views |
  • submit to reddit

Well, this is almost true. By default the following Camel components are installed with the Camel feature:

Camel component

Short description

Bean component

Bind Spring beans to a message exchange.

DataSet

Use a data set to send large number of messages to stress test a message flow.

Direct

Synchronous call to another endpoint.

File

Consume and produce files from a specified directory.

List

A List can be used to test and debug message exchanges.

Log

Log the message exchange with Jakarta Commons Logging.

Mock

Use the mock component to test a message flow.

SEDA

Asynchronous call to another endpoint in the same Camel Context.

Timer

Send a message on a specific time interval.

Validator

Validates the message payload with XML Schema and JAXP validation.

VM

Asynchronous call to another endpoint in the same JVM.

XSLT

Transforms the message using a XSLT stylesheet.

In the simple file example we used the Camel file component. As you can see on the Camel website, there are a lot of other Camel components available (http://activemq.apache.org/camel/components.html). So if we would like to use the Camel JMS component in the FUSE ESB we should do an additional installation. But the Camel JMS component is not available by default in the features list. To make other Camel components available in the features list we should add a features URL where the provisioning component can retrieve the additional components. Execute the following command to do this using a URL that matches the version of FUSE ESB that you are using:

features addUrl http://repo.fusesource.com/maven2/org/apache/servicemix/camel/org.apache.servicemix.camel.features/4.0.0.4-fuse/org.apache.servicemix.camel.features-4.0.0.4-fuse-features.xml

When we execute the ‘features list’ command now, a large number of additional Camel components is available to install, including the Camel JMS component. So to enable the Camel JMS component functionality just execute the ‘features install camel-jms’ command. So now let’s look at a bit more complex example using the Camel Java DSL implemented with an OSGi bundle.

Deploying an OSGi bundle

In the first example we showed how to use the Camel Spring XML configuration. But when we want to implement a Camel Java DSL route or use Java beans in the integration logic, we need another deployment mechanism. In FUSE ESB 4 the most obvious choice would be an OSGi bundle utilizing the Spring dynamic modules (Spring DM) framework. Figure 3 shows an example we’ll implement with an OSGi bundle.

Figure 3 Camel example that consumes a JMS message and validates it against an XML Schema definition. There is a standard target queue and an error queue in case of validation errors.

We’ll implement a ValidationRouter class with the Camel Java DSL that consumes a hello message from the camel.jms.in JMS queue. The message exchange will be logged and then it will be validated against the hello.xsd XML Schema definition file. When there are no validation errors, the hello message will be sent to the camel.jms.out queue and in the case of validation errors, the message will be forwarded to the camel.jms.error queue.

Published at DZone with permission of its author, Tijs Rademakers.

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

Comments

Claus Ibsen 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/

Claus Ibsen 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.

Claus Ibsen 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

Tijs Rademakers 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

Tang Yong 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/

Tijs Rademakers replied on Sat, 2009/03/14 - 11:51am in response to: Tang Yong

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! 

Erwin Teseling replied on Wed, 2009/03/18 - 8:12am in response to: Robert Williams

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

Tijs Rademakers replied on Wed, 2009/03/18 - 2:52pm in response to: Erwin 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

Erwin Teseling replied on Wed, 2009/03/18 - 5:39pm in response to: Tijs Rademakers

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!

Ali Yang replied on Wed, 2010/07/14 - 10:59am

Hi Tijs, I have talked with a guy from FUSE. He said OSGi Service function just like a registry in OSGi container. It is very simple. So what about your opinion? What is the benefit to use OSGi Service to expose functions in one Bundle to other Bundles in OSGi container? Thanks

Mohit Dklkjhsds replied on Mon, 2010/08/16 - 10:20am

Hi Tijs, I am fairly new to java,i have just worked on a very modest core java project.I have little idea of web services but i am a complete stranger to the terminologies like FUSE ESB,JBI,OSGI,CAMEL,SERVICEMIX. Can you please suggest what i must first get acquainted with before jumping into this ,if it requires any prior knowledge(which, i am almost certain it does).Or if possible can you please dumb it down a little for people like me who have very little idea what FUSE ESB is all about and also a little about it's other components. Thanks & Regards Mohit

Larry Xu replied on Mon, 2010/11/15 - 3:27am

where is the source code ?

Dead Devil replied on Tue, 2011/03/15 - 4:17pm

Greetings!! Many thanks for the examples but i have some issues with this. When i deploy camel-jms-example-1.0.jar, by copying it to the deploy directory, i get this error Exception in thread "SpringOsgiExtenderThread-6" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicationContextExecutor.java:345) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.fail(DependencyWaiterApplicationContextExecutor.java:401) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:287) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:175) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718) at java.lang.Thread.run(Thread.java:636)

Carla Brian replied on Sat, 2012/06/30 - 11:12am

 Fuse ESB has a pluggable architecture that allows organizations to use their preferred service solutions in their SOA. - Mercy Ministries

Comment viewing options

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