Skip to main content

JBoss Fuse - Fuse workshop 101 - Part Two

In an ideal world, all software system should use the same protocol, and passing the same type of documents, but sadly, due to time, needs and other reasons that I can't think of, current software systems are full with different types of protocol and formats of data. As a integration developer, we spend a great deal of time just to make two software system understand each other.

Fuse workshop 101 part two is all about message transformation.

In JBoss Fuse, there are different kind of transformations,

So Format or Type and Message content enrichment or reduction are types of transformation that plays around and changes your message body. and Metadata updates mainly modify the header of your messages.

An example of Format transformation is from XML to CSV or from CSV to JSON, or simply just flattening out from one XML to another. whereas Type transformation is about changing the Object type to another, such as from java.lang.String to java.lang.Integer.

So there are few ways you can do format/type transformation, Camel has built-in component, called Marshal, basically converting from a more higher level of data (here we simply means java bean) to lower levels of data like XML, CVS or JSON etc...

the opposite of that is, of course, Unmarshal. Converting from files into complex java object.

The tooling in JBoss Developer studio will show all the available ready to use data format.
take for example, converting from XML to JSON, this is the why to describe it.


Or you can do it with JAXB

  <jaxb partClass=“example.TradeOrder” contextPath=“example"/>

Another way of transforming the message is to use the transform tag(component) in Camel. It uses various scripting languages, by running message body through the script you set, it will generate the result as the transformed output. Here is an example using javascript.



OK! Now we have Processor and Bean left, the last two ways of transformation are very similar, in both cases you need to create a java class. You will pass in the message through the Processor or Bean. And inside Processor and Bean, you will add your transformation logic there. This is highly customizable.

The only difference between the two, is the parameter you pass through them, with Process, you need to first implements the camel.Processor interface, then in the execute method, you will find the parameter is the exchange object, so you will have the access to the whole message. Whereas, in Bean, it's just a POJO, by adding the transform logic inside a method, the message will pass through it. And NOTICE, it's only the BODY of the message. So the parameter of the method is actually your message body.

There is another way of transforming messages, using the Enterprise Integration Pattern, there are a few built-in patterns that allows you to easily change or transform your message, I won't go too much detail into that. We will talk about EIP in the later workshop.

Time for another Camel Ride, this time, we are taking the Camel route we built, which is taking a file from a vendor and then place it in another folder for another vendor to retrieve later. Now we know that Vendor sending us the stock ordering info is providing their content in XML, and the vendor that needs this info needs it to be in JSON. And beside both vendor, our company needs to process the content too, and since we are a Java-shop, we want to make sure the content is turned into POJO.

Here is the slides for part 2

And this is the lab instruction.
Enjoy! JBoss Fuse workshop part 3 is coming up next!

Workshop part 1 - Camel basic and components
Workshop part 3 - Enterprise Integration Patterns


I followed your 2nd ride lab but stuck at adding dependency to pom.xml

JDBS show following error:

missing artifact org.apache.camel:camel-jaxb:2.12.0.redhat-610379

missing artifact org.apache.camel:camel-jackson:2.12.0.redhat-610379

(for jaxb, I can search from Dependencies tab of pom.xml but search not found for jackson)

Please helps. How to fix this?
Christina Lin said…
Check which repo you are pulling your maven dependency from.

<repository> ​ <id>fusesource</id> ​ <url></url> ​ <snapshots> ​ <enabled>false</enabled> ​ </snapshots> ​ <releases> ​ <enabled>true</enabled> ​ </releases> ​ </repository>
Hi Christina
My problem is fix by change repo.
jmandawg said…
Order3.xml does not work. I don't think it is valid for the schema. I get the following error:

Caused by: com.sun.istack.SAXParseException2; lineNumber: 3; columnNumber: 11; unexpected element (uri:"", local:"multiple"). Expected elements are <{}stocktrading>
Shoaib Khan said…
Hi Christina,

So far I found it to be very informative and updated tutorial based on latest release of JBoss Fuse. Thank you so much for making it available out there on web.

Just curious to know if the slides here can be available in PDF format as its bit difficult to switch full screen slides and back to JBoss Developer to follow step by step. Thank you.
Hi Cristina....

I got this issue when i finish the Data Transformation box.

Unexpected error: String index out of range: -1
String index out of range: -1
M Vishukumar said…
Hi Christina...

Could you please answer this question?
I am not able to see options in Marshall and Unmarshall pellet.

Thanks, Vishu

Popular posts from this blog

Fuse Integration Service - Setup JBDS and create first quickstart application

Before we go and start creating our first application, I want to show you how to setup your JBoss Developer Studio, create a small application from the quickstart example and then running it on Fuse Integration Service.

I am using JBoss Developer Studio version 9, you can find it here.
After download the

double-click it, and start installing with default values.

After successful installation, we will need install the plugins for Fuse, on JBoss Central view, select software update, select enable early access.

And select JBoss Fuse Development for the plugin,

Click on install, and we are all set to go!

First thing first, we want to create a Fuse project to deploy on the base of Fuse Integration Service, which is OpenShift. If you have not installed it, please go back to my previous post for instructions. So on your JBDS, right click and start creating the project. Select new, maven project, if you have installed the plugin correctly, you should …

Red Hat JBoss Fuse/A-MQ - Fuse and A-MQ Version 6.3 GA is released!

Fuse and A-MQ 6.3 GA has just went out. Maybe, you would think this is just only a minor version release why should I care? Hold your thoughts on that! Because they have done a lot of improvements and also added many new features into this release.

Besides various bug fixes and making sure Fuse Fabric is much more stable. There are two major change in this version update:

New Tooling in JBoss Developer Studio (JBDS) 9.1 GA. Newer Apache Camel version – Camel v2.17. I was really impressed by the work put in to make developing Camel application much simpler. First is the installation of tooling itself. Now it has a all-in-one installer so you don't need to worry about which plugins you need to check. See the videos below to see the new "Getting Started" of Fuse 6.3.

And If you notice from the above video, the presentation of camel route in JBDS has also updated. It fixed some of the miss representation of logic and making it easier to read.

Old Camel Route
New Camel Route
On …

RHTE - Supercharge your integration services

Red Hat Tech Exchange has taken place in Vietnam, Ho Chi Minh city two weeks ago, it is a great event held by Red Hat in Asia Pacific Region. It is open to all Red Hat partners who are interested in learning what Red Hat is doing recently, see what the trend of the open source world, basically it is a great event to share your knowledge and experience, to meet other enthusiastic people.

I am very fortunate to talk in this great event, to talk about the things I have been working on and even discuss it with many. Also got lots of great ideas too. So here are the slide.

My first talk was with Thomas Qvarnström about how to handle large size data in JBoss Fuse and how JBoss Data Grid can help in the situation.

Here is the agenda of the talk, we will be talk about this in the up coming webinar on 24th Sept.

Integration often involves storing, retrieving, and transforming data. Using a traditional database in your integration is likely to becomes a bottleneck that is expensive and hard to …