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. 


smooks    
switchyard
switchyard-internal-core  
dozer      
xalan-deps

                             
These ones are the feature libraries of the components in Switchyard


switchyard-camel-jpa-hibernate              
switchyard-amqp           
switchyard-atom                               
switchyard-bean                               
switchyard-bpel                      
switchyard-cdi                                
switchyard-camel
switchyard-camel-cxf
switchyard-file
switchyard-ftp  
switchyard-http    
switchyard-internal-http                      
switchyard-jms
switchyard-jpa
switchyard-mail
switchyard-mqtt                               
switchyard-netty
switchyard-quartz                                      
switchyard-rss                                
switchyard-rest                               
switchyard-internal-rest                      
switchyard-sca                                
switchyard-internal-sca                       
switchyard-sql  
switchyard-soap
switchyard-internal-soap    
switchyard-sap






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          
                                          fabric-ensemble-0000-1                   
                                          jboss-fuse-full                          
  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. 

Comments

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

Popular posts from this blog

Red Hat JBoss Fuse - Getting Started with Fuse Integration Service 2.0 Tech preview

I just realized that I did not do a getting started for Fuse Integration Service 2.0 Tech preview before I did the pipeline demo, thanks for those of you who reminded me! :)

To get started with FIS 2.0, for people who has just getting to know the technology, here is how I interpret it. Basically, it's divide into two aspect,

1. Integration development, FIS uses Apache Camel as the core technology that creates, orchestrate, compose microservices into a super lightweight thin integration layer, and become the API provider and service orchestrator through exposing RESTful or messaging service endpoints. And you can choose to either package and run it with Spring-Boot or Karaf.


2. Application Deployment and Management, FIS takes advantages of OpenShift platform, and allows you to separately deploy the micro-integration service among distributed environment, at the same time takes care of the failover, high availability, load balancing and service lookup problem for you.


So, now we know …

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 …

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

jboss-devstudio-9.0.0.GA-installer-eap.jar
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 …