Friday, May 2, 2014

Red Hat JBoss Fuse Service Works Workshop - Part 1 Environment Setup

I am starting a Fuse Service Works Workshop series this week.  The workshop is designed to get you started quickly and easily on a project with Fuse Service Works.  We will go through the concepts and components of Service Component Architecture, Service Lifecycle Management and Business Transaction Monitoring.

Today we will go through an introduction of the series to get you started with the workshop.

The workshop series will be split into five postings and will concentrate on creating the switchyard application, moving the deployment through Service Lifecycle Management from development through production and monitoring the services through the Business Activity Monitoring.   The Home Loan Application will be our application that we will use during the series.  Now onto Part 1 of the Fuse Service Works Workshop.

Overview of the workshop
Home Loan Application

We will use a the Home Loan application which will be built in Part 2.  Some of the application is already built for you.  The application includes a BPMN2 Process, a Camel Route, a Rules Component, a REST service, a JMS service, SOAP service and multiple unit test.

The code for each blog will be updated on github each week.  We will update each folder as we progress: Guides, which contains the individual guides, Support, which will contain supporting files such as an example standalone.xml and h2 file, Lab 1, which will contain lab 1 for Switchyard, Lab 2 which will contain the Service Lifecycle Management, and Lab 3 which will contain Business Activity Monitoring.  The repository is located at https://github.com/FuseServiceWorksByExample/FSWWorkshop.

The application will be described in more detail in Lab 1.

Environment Setup
Step 1. Download Fuse Service Works (FSW) from http://www.jboss.org/products/fsw.html
Step 2. Install FSW according to the instructions at http://www.jboss.org/products/fsw.html
Step 3. Setup the Database
Launch the H2 db and console via the h2 jar in your FSW install
java -jar modules/system/layers/base/com/h2database/h2/main/h2-1.3.168-redhat-2.jar  
At the login screen for the H2 console, use the following values. $FSW_HOME is where you have installed FSW; be sure to replace this with the actual directory for your installation.
JDBC URL: jdbc:h2:file:$FSW_HOME/jboss-eap-6.1/standalone/data/h2/customer;mvcc=true  
User Name : sa  
Password : sa  
In the console, create a table:
CREATE TABLE CUSTOMER(  
    SSN VARCHAR(11) PRIMARY KEY,  
    FIRSTNAME VARCHAR(50),  
    LASTNAME VARCHAR(50),  
    STREETADDRESS VARCHAR(255),  
    CITY VARCHAR(60),  
    STATE VARCHAR(2),  
    POSTALCODE VARCHAR(60),  
    DOB DATE,  
    CHECKINGBALANCE DECIMAL(14,2),  
    SAVINGSBALANCE DECIMAL(14,2));  
And insert some test data:
INSERT INTO CUSTOMER VALUES   
    ('800559876', 'Joe', 'Deeppockets-existing', '345 Pine Ave', 'Springfield', 'MO', '65810', '1966-07-04', 14000.40, 22000.99);  
INSERT INTO CUSTOMER VALUES   
    ('610761010', 'Sally', 'Shortchange-existing', '456 Larch Lane', 'Springfield', 'MA', '99999', '1966-08-05', 9100.10, 2750.75);  
INSERT INTO CUSTOMER VALUES   
    ('680777098', 'Barbara', 'Borderline-existing', '567 Poplar Pkwy', 'Worcester', 'MA', '01604', '1976-09-06', 300.41, 11.01);  
Add the following datasource definition to standalone-full.xml:
<datasource jndi-name="java:jboss/datasources/CustomerDS" pool-name="CustomerDS" enabled="true" use-java-context="true">  
    <connection-url>jdbc:h2:file:${jboss.server.data.dir}/h2/customer;mvcc=true</connection-url>    
    <driver>h2</driver>  
    <security>  
        <user-name>sa</user-name>  
        <password>sa</password>  
    </security>  
</datasource>  
Step 4. Setup JMS
Add the JMS user
${FSW_HOME}/bin/add-user.sh  
Application User  
Application Realm  
Username : guest  
Password : guestp.1  
Roles : guest  
Start the server:
bin/standalone.sh -c standalone-full.xml  
In a separate terminal window, add a JMS queue:
bin/jboss-cli.sh --connect --command="jms-queue add --queue-address=LoanIntake --entries=LoanIntake"  
Step 5. Download JBoss Developer Studio (JBDS) 7.1 from https://www.jboss.org/products/devstudio.html
Step 6. Install JBDS according to the instructions at https://www.jboss.org/products/devstudio.html
Step 7. Download JBoss Integration Stack (JBIS) 4.1.4 from http://tools.jboss.org/downloads/jbosstools_is/kepler/4.1.4.Final.html
Step 8. Install JBIS according to the instructions at http://tools.jboss.org/downloads/jbosstools_is/kepler/4.1.4.Final.html
Now your environment is ready for the next blog.