Skip to main content

Red Hat JBoss Fuse - Switchyard in OSGi

If your have ever played with JBoss Fuse Service Work, then you will probably know this already. So what exactly is switchyard?

SwitchYard is a structured framework for developing integration applications using the design principles and best practices of Service Oriented Architecture.

It supports the SCA, SCA stands for Service Component Architecture, it is basically specifications that describe a model for building applications and systems using a Service-Oriented Architecture. By applying the standards way of describing SOA's available components and services in integration solution, we will then have this abstract layer of services, that is not specifically belong to single language, or implementation. By implementing this standard, we will have a complete, well define SOA architecture.

In previous version of JBoss Fuse and JBoss Fuse Service Work, one of the dividing factor between them is the containers they are running. JBoss FSW runs in JBoss EAP which is the JavaEE container. And JBoss Fuse runs on Karaf, the OSGi standard container. But now that the Fuse can run on both JavaEE and OSGi, what about Switchyard? I can very happy to tell you, YEP! it's OSGi ready now.

Let's take a look at Switchyard features that is available in JBoss Fuse server.

These ones are the basic switchyard feature, and the libraries you will need. 


These ones are the feature libraries of the components in Switchyard


Then the rest of the features are quickstarts and demos for you to play with.
By adding the required library into container or add them to your application profile, it will enable the Switchyard running on Karaf.

Let's take one of the quick start demo, and see how to deploy it in Karaf or Fabric environment in JBoss Fuse.

Karaf - Standalone OSGi container

Karaf will be a simple and standalone OSGi container, it has fewer steps, basically, all we have to do is installed the feature and then it's ready to go.

The repository url should have already set in JBoss Fuse, all we have to do is to install the demo feature.

  • features:install switchyard-quickstart-camel-cxf

This will download and install the feature and we can start play with it.

Fuse Fabric - Set of Standalone Managed OSGi container

But, with Fuse Fabric, because we have another layer of control, the profile, therefore we will need , first create a profile,  (Make sure you have created your Fuse Fabric beforehand.)

  • profile-create demo-myswitchyard

Create a small container for this small service

  • container-create-child root mydemo

then we add the features we need in the profile, deploy the profile to a empty container, and then we are done!

  • profile-edit --features switchyard-quickstart-camel-cxf-binding demo-myswitchyard

Give the container a few good minutes to down and install the bundles in the container, type

  • container-list 

see if every container shows success in their status.
JBossFuse:karaf@root> container-list 
[id]      [version]  [type]  [connected]  [profiles]      [provision status]
root*     1.0        karaf   yes          fabric                  success          
  mydemo  1.0        karaf   yes          default                 success       

If this is what you see, then congratulations!!
This CXF binding demo is a very interesting example, basically it shows usage of SOAP with Camel Cxf component. The SwitchYard service binds to a Cxf URL and we can call the service via the URL of the CXF component.

This demo is an order service, the order is send by client through web service, the data is then send to Camel, which is going to route the message to it's destination, that is the warehouse service, checking the inventory.

The switchyard.xml show the architecture of the demo. The composite, which is the large blue rectangular shape base. It defines the boundary of your application, anything that is inside the rectangle is your application, and anything outside are external resources. We see there are two endpoint expose which let's outer resource to call. And an endpoint that calls the external resources.

In the middle you can see there are two Camel components, which passes the message we got from client, then process it within camel route then pass it out to next step in Switchyard, so how do we integrate Camel with switchyard? Simple, let's look at the Camel route here:

Notice some of the components started with switchyard? That's right, by creating a switchyard endpoint, it will be available to receive or produce data to your switchyard application. And to start the demo, simple run

  • mvn exec:java -Pkaraf -Dexec.args="Boeing 10"

Which will start the ClientProcessor in the project, and send a SOAP message ordering Boeing with amount of 10. Login in the to the console http://localhost:8181/hawtio with your ID/PWD.

Click on the container we have just create.
 It will take you to the container view,  here you will be able to see what is happening.
What I love about this version of JBoss Fuse, is now you get to see all the route at once,

Alright, that's all for this post. More about Switchyard in next one. 


Unknown said…
hi, miss Christina, could make a tutorial how to send/received message to hipchat in jboss ?

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 …