Wednesday, June 25, 2014

Red Hat JBoss Fuse Service Works Workshop - Part 3 Lab 1 Switchyard Step 0

Our Fuse Service Works workshop continues 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 building the Switchyard application.

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 3 of the Fuse Service Works Workshop.

Overview of the workshop
  • Part 1 - Environment Setup 
    • http://planet.jboss.org/post/red_hat_jboss_fuse_service_works_workshop_part_1_environment_setup
  • Part 2 - Lab Introduction
    • http://planet.jboss.org/post/red_hat_jboss_fuse_service_works_workshop_part_2_lab_introduction
  • Part 3 - Lab 1 Switchyard - This Week Step 0
    • Get familiar with the development environment
    • Application design and implementation
    • Hands on experience with important SwitchYard principles
  • Part 4 - Lab 2 Service Lifecycle Management 
    • Gain experience with service governance workflows in Fuse Service Works
    • Become familiar with the Design-Time Governance and S-RAMP consoles
    • Manage a service through the dev, qa, stage, and production tasks
    • Learn Service Lifecycle Management principles
  • Part 5 - Lab 3 Business Activity Monitoring
    • Gain experience with Runtime Governance capabilities in Fuse Service Works
    • Become familiar with Service Activity Monitoring and reporting
    • Become familiar with Policy Enforcement
The code for our series is located on Github - https://github.com/jboss-switchyard/learning/tree/master/summit2014

Switchyard

SwitchYard is a component-based development framework focused on building structured, maintainable services and applications using the concepts and best practices of SOA. It works with Apache Camel to provide a fast, simple, flexible integration runtime with comprehensive connectivity and transports. A uniform application model augments Apache Camel, joining Java EE, BPM, rules, orchestration, and routing into a cohesive development model and runtime. Common functionality and cross-cutting concerns - validation, transformation and policy - are isolated from business logic and handled declaratively. This ensures consistency and eliminates duplication, offering developers a clear view of the structure and relationships of services in an integration application.

http://switchyard.jboss.org/

Now on to Home Loan Application.  Our Lab will be in 7 steps.

Step 0: Getting Started
Step 1: Component Service
Step 2: Component Reference
Step 3: Camel Routing
Step 4: Reference Binding
Step 5: Transformation
Step 6: Service Binding
Step 7: Implementing RESTful status service

Step 0 - Getting Started


Let's import the lab 1 project and introduce key editor concepts.  First lets start JBoss Developer Studio.  Next we want to select a workspace such as the one shown below.







The example shown here was used in the Summit 2014 lab.


Next let's import the existing lab 1 project.  NOTE: Please make sure that you read the Gotchas from the lab environment setup.














Navigate to the location of lab1 and make sure the pom.xml is checked for org.switchyard.training.summit2014.lab1.  This is making the assumption you have cloned the repository from github (https://github.com/jboss-switchyard/learning/tree/master/summit2014).  The lab1 folder contains the source. After importing the project go to the Project Explorer in the left frame and expand the lab1 project.

Let's first look at src/main/java.
Next Let's look at src/main/resources
Now Let's look at src/test/java
Switchyard allows you to unit test individual services in your applications as you build it.  For example Step1Test contains test methods which invoke CreditService directly to verify that it's behavior matches requirements.
Now Let's look at src/test/resources
Now Switchyard!
The Switchyard node provides two functions in the project explorer:

  • An outline style view of the application configuration (services, references, components, etc.)
  • Shortcut to the Switchyard visual application editor via a double-click
Looking at the visual editor:
Looking at the wiring in the visual editor:
Now let's examine the Button Bar.  The button bar is really convenient when interacting with the visual editor.  Just hover over the portion of the diagram you want to interact with and choose an option from the button bar.  This image provides a key to the more frequently used buttons on the button bar.  The properties button is used most by far, so definitely make a note of that one.  If the other buttons don't make sense now, don't worry they will soon.

Next Week we will continue with Step 1.