Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Fuse Integration Service - JBDS Setup and Quickstart App Creation

DZone's Guide to

Fuse Integration Service - JBDS Setup and Quickstart App Creation

Learn about initial setup and app creation with JBoss Developer Studio, then run it on Fuse Integration Service!

· Integration Zone
Free Resource

Share, secure, distribute, control, and monetize your APIs with the platform built with performance, time-to-value, and growth in mind. Free 90 day trial 3Scale by Red Hat

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 downloading the jboss-devstudio-9.0.0.GA-installer-eap.jar file, 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 see the "Fuse Tooling Remote Archetype Catalog" under Catalog option, select it.

Select the cdi-mq archetype and for current OpenShift 3.1 make sure it matches the archetype version 2.2.0.redhat-079,

Create the application with 
  • Group ID: com.redhat
  • Artifact ID: mqservicedemo

The project should be created.  The reason we are creating with this archetype is because I want to show you a brilliant idea from Fabric8 that will be very useful. In Fabric8, by using the CDI extension, we can inject service we created in OpenShift to the client by simply specifying the @ServiceName and @Factory in our application. It will automatically locate where the service's clustered Host and Port in our OpenShift environment, since if we are moving to cloud, the server instance will change frequently, so it will be unrealistic to point to real physical location.

Let's start by creating a messaging service named Broker in our Fuse Integration Service, login to OpenShift, which is the base platform of Fuse Integration Service, create a project called demo if you have not already done so.

Add AMQ broker to demo project, we will use the most basic image, choose amq62-basic.

And you will be redirect to a configuration page,  set your application name to broker, and set your prefer ID and PWD, click on "Create" button to start create the service.


It'll take a few minute to startup. And you should be able to see the service up and running in the console.
Go back to JBDS, our quickstart application should be created, navigate the project, go to pom.xml, under plugin docker-maven-plugin add the following environment variable. The reason it can pick up this environment variable is because we have injected the configuration through the ActiveMQConfigurer with Object ActiveMQConfig to set the configurations.
  • <BROKER_AMQ_TCP_USERNAME>YOUR_ID</BROKER_AMQ_TCP_USERNAME
  • <BROKER_AMQ_TCP_PASSWORD>YOUR_PWD</BROKER_AMQ_TCP_PASSWORD>
In the routing code, you should be able to see Fabric8 API, and it is injecting ActiveMQ component with broker name, and setting the alias for the endpoint, change the service name to broker-amq-tcp
@Inject
@ServiceName("broker-amq-tcp")
@Alias("jms")
ActiveMQComponent activeMQComponent;

We are now ready to deploy our application, we are going to build with S2i method, I talk more about in the upcoming post, for now, just think of it as a way to package our code to a docker image. There are few things we need to make sure it's properly setup before we start deploying, first is the docker settings, to get all the info, go to where your install your vagrant for OpenShift and run

There you will get all the environment details to set, save it for now,
And alway remember to restart your application after running the adbinfo with

In command line mode, go to your application directory, can start setting the docker environment variables. And then login to OpenShift with your OpenShift client tool, if you don't have it, you can down load it here.

You will be prompt to enter your login ID and pwd, please login, then we can start deploying with command

Once you have successfully deploy the application, please go back to the OpenShift console, you should be able to see your mqservicedemo pod running, check the log, and you should see something similar to this:

That's all for this time! Thanks! Here is the detail video of how to do it. Thanks!

Discover how you can achielve enterpriese agility with microservices and API management

Topics:
java ,jboss ,jboss developer studio ,fuse

Published at DZone with permission of Christina Lin, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}