JBoss Fuse Lesson 1: Helloworld Fuse
In this tutorial we will move our first steps with Red Hat JBoss Fuse, we will learn What is JBoss Fuse, how to install it and we will run a first demo application on it.
What is JBoss Fuse ?
In a nutshell Red Hat JBoss Fuse is an open source enterprise integration platform and service bus. The following picture introduces the core building blocks of JBoss Fuse:
So basically JBoss Fuse is an integration platform which includes some best of breed integration producst from Apache such as Apache CXF and Apache Camel, a robust messaging platform, Active MQ and a container based on the project Apache Karaf and Fabric.
The nice thing is that you can design your integration services using a tooling platform named JBoss Developer studio and use a variety of management console (including the Fuse Management Console) to administrate your services.
Installing JBoss Fuse
Installing JBoss Fuse is pretty easy, just reach the download page. Once downloaded, unzip the full installer
Now you can start JBoss Fuse:
cd jboss-fuse-6.1.0.redhat-379 bin\fuse.bat
Once started the JBoss Fuse shell (based on Apache Karaf) console will display:
The first usage of the console will be creating an admin user for accessing the Web Console, which is available at:
In the Fuse shell execute the following command:::
And type in a username and password.
Deploying your first example on JBoss Fuse
The JBoss Fuse supports multiple deployment models. This means that you can deploy the following artifacts on the top of it:
- OSGi bundle: Since Red Hat JBoss Fuse container is fundamentally an OSGi container, the OSGi bundle is the native format for the container. An OSGi bundle is a JAR file augmented with metadata in the JAR's META-INF/MANIFEST.MF file.
- Fuse Application Bundle: A Fuse Application Bundle (FAB) is a Fuse-specific deployment unit optimised for the JBoss Fuse container. FABs are a plain JAR built using the Apache Maven. FABs address some of the issues when using OSGi such as dependency resolution and class-loader conflicts.
- WAR: A Web application ARchive (WAR) is the standard archive format for applications that run inside a Web server.
- JBI service assembly: A Java Business Integration (JBI) service assembly is the basic unit of deployment for JBI applications.
We will deploy an OSGi quickstart example that is based on the blueprint framework.
The blueprint framework is a dependency injection framework defined by the OSGi Alliance. It is similar to Spring (in fact, it was originally sponsored by SpringSource), but is a more lightweight framework that is optimized for the OSGi environment.
As this example uses Apache CXF features, we will activate Apache CXF by executing the following command in the Fuse shell:
Now let's move into the SOAP quickstart example:
This demo basically contains a blueprint file and a simple JAX-WS Web service. Here is the blueprint file which is used to integrate Fuse with the Web service:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws" xmlns:cxf="http://cxf.apache.org/blueprint/core" xsi:schemaLocation=" http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd"> <cxf:bus> <cxf:features> <cxf:logging/> </cxf:features> </cxf:bus> <jaxws:endpoint id="helloWorld" implementor="org.jboss.quickstarts.fuse.soap.HelloWorldImpl" address="/HelloWorld"/> </blueprint>
Now build the example with: (Maven required)
mvn clean install
Finally install the example by executing the osgi:install command in the Fuse shell, passing as argument the Maven dependency that you have just built:
osgi:install -s mvn:org.jboss.quickstarts.fuse/soap/6.1.0.redhat-379
The above command will return the ID of the bundle that has been just installed. You can check that everything is ok by issue the command:
Your bundle should be present at the end of the list:
. . . . . [ 252] [Active ] [Created ] [ ] [ 60] JBoss Fuse :: Examples :: SOAP (6.1.0.redhat-379)
After you deployed this quick start, you will see the 'HelloWorld' service appear in the 'Available SOAP Services' section, together with a list of operations for the endpoint and some additional information like the endpoint's address and a link to the WSDL file for the web service
You can use an external tool such as SoapUI to test web services or Change to the soap directory and run the following command: