In this lesson we will learn how to install JBoss Fuse tooling on JBoss Developer studio and to run a Fuse project within it.

Start by downloading JBoss Developer Studio . In this trail we will use the Standalone installer which requires about 500 MB disk space.

Once downloaded it, execute the JAR file:

java -jar jboss-devstudio-8.1.0.Beta1-installer-standalone.jar

The JBoss Developer Studio wizard will start. Just follow the default options and choose a path for your installation. Once completed, execute the jbdevstudio shell:

jbdevstudio.bat

Installing Fuse Tooling

In order to install the Fuse tooling, you need to reach the "JBoss Central" view and check the "Enable early access" check box as indicated by the following picture:

jboss fuse tools installation developer studio

Click on Install/Update and follow the wizard to complete the installation. A reboot of JBoss Developer Studio will be required to use the new tooling features.

Creating your first Fuse project from JBoss Developer studio

Once that you have completed the tooling installation you can use from the File menu: New | Fuse Project. Choose the name of the project and, in the next dialog, select an archetype for your project:

fuse jboss developer studio tutorial howto example

As we want a new Camel project with OSGi support, ready to be deployed on JBoss Fuse, select the camel-archetype-blueprint, choose a GroupId, ArtifactId, Version and Package. Click on Finish.

Here is the project which has been just created:

jboss fuse tutorial developer studio howto tutorial

The project includes a blueprint.xml file which describes our service:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/blueprint"
       xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

  <bean id="helloBean" class="com.mycompany.demofuse.HelloBean">
      <property name="say" value="Hi from Camel"/>
  </bean>

  <camelContext trace="false" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
  <route id="timerToLog">
    <from uri="timer:foo?period=5000"/>
    <setBody>
      <method ref="helloBean" method="hello"></method>
    </setBody>
    <log message="The message contains ${body}"/>
    <to uri="mock:result"/>
  </route>
</camelContext>

</blueprint>

As you can see, this service basically sends messages from a Timer component which are intercepted by the HelloBean, logged by the Log component and sent to the mock: which gathers the result and can be used in the Testing class.

The nice thing of it is that, since you have installed the tooling, you can design your blueprint graphically with the Design view:

jboss fuse developer studio tutorial example

As the project is a Maven one, you can compile it using:

mvn clean install

Now, after that you have started Fuse, you can deploy it on the Fuse OSGi container by executing from the Karaf shell:

JBossFuse:karaf@root> osgi:install -s mvn:com.mycompany/demofuse/1.0.0-SNAPSHOT
Bundle ID: 260

Related tutorials

You might be interested as well in this tutorial: JBoss Fuse Lesson 2: Building your first Fuse project with Maven

0
0
0
s2smodern

W

i

l

d

F

l

y

 

c

h

e

a

t

s

h

e

e

t