Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Latest commit

 

History

History
342 lines (225 loc) · 14.6 KB

appdev-in-the-cloud-travel-agency.adoc

File metadata and controls

342 lines (225 loc) · 14.6 KB

App Dev in the Cloud - Process Driven Travel Agency

1. Overview

Short description: Process driven travel booking application on OCP

Long description: Ready to get hands-on with AppDev in the Cloud with container based process driven solution? This workshop will let you experience the wonders of Red Hat’s open technologies for cloud-based container application development, letting you integrate multiple services, business rules, user tasks and more into a process driven cloud solution. In this workshop you’ll explore and run a travel agencies online booking application and unique front end application. You’ll be given the OpenShift Container Platform, then installing JBoss BPM Suite to work with the booking projects rules, processes, task forms, data model and more. After building and deploying the process driven application, you’ll use a web front end to connect to the process application through a REST API, sending a booking and verifying the process execution.

  1. This demonstration showcases the following:

    • Deploying a multi-layered, process driven application on OpenShift Container Platform.

    • Deploying JBoss BPM Suite product with process project, exploring and testing processes.

    • Demonstrating use of BPM compensation features (roll-back) in JBoss BPM Suite.

    • Deploying services for use in process driven application.

    • Deploying a web front-end UI that leverages BPM REST APIs.

  2. Goal

    • Deploy a complex process driven application in the Cloud.

    • Deploy and use frond end application functioning as a REST client.

  3. Prerequisites

    • A basic understanding of OpenShift, JBoss BPM Suite.

Current versions of products used:

Product Version

OpenShift Container Platform

3.6

JBoss EAP

7.0

JBoss BPM Suite

6.4

1.1. Environment

The demo environment consists of the following systems:

Hostname Internal IP Description

bastion.example.com

192.168.0.5

Bastion host

master.example.com

192.168.0.10

Master

node01.example.com

192.168.0.11

Node 01

node02.example.com

192.168.0.12

Node 02

node03.example.com

192.168.0.13

Node 03

Note
HAProxy is running on the workstation machine. This provides a level of port forwarding to allow access to the OpenShift console and the JBoss application and other services running on OpenShift to overcome some DNS and routing limitations in the underlying Ravello environment. This includes port 80, 8443 and 8080-8085.

1.2. Provision Your Demo Environment

  1. If you have Red Hat Product Demo System access, log in to the Red Hat Product Demo System with your SSO credentials.

  2. Go to Services → Catalogs → Service Catalogs.

  3. Under All Services → AppDev in the Cloud, select Process Driven Travel Agency.

  4. On the right, click Order.

  5. Read all of the information on the resulting page, check the necessary box, and click Submit.

    Important
    • It takes about 15-20 minutes for the demo to load completely and become accessible.

      • Wait for the full demo to load, even if some of its systems are marked "Up."

    • Watch for an email with information about how to access your demo environment.

      • Make note of the email’s contents: a list of hostnames, IP addresses, and your GUID.

      • Whenever you see GUID in the demo instructions, replace it with the GUID provided in the email.

    • You can get real-time updates of your demo environment at https://www.opentlc.com/rhpds-status.

    Tip
    Be mindful of the runtime of your demo environment! It may take you longer than the 3 hours allotted to complete the demo, so you may need to extend the runtime. This is especially important in later steps when you are building virtual machines. For information on how to extend runtime and lifetime, see https://www.opentlc.com/lifecycle.

2. Getting Started

  1. From a web browser, open URL below in its own window or tab, using admin for the username and r3dh4t1! for the password:

Tip
You can also find these URLs in the email you received when you provisioned the demo environment.

3. Review the Environment

  1. Once the OpenShift environment is up and running, log in to the OpenShift Enterprise Console at https://<IP_ADDRESS_OF_WORKSTATION>:8443/console, using these credentials:

    • Username: admin

    • Password: r3dh4t1!

  2. Nothing has been installed yet, so no projects have been created yet. You’ll do this soon.

3.1. Access the Travel Agency project on workstation (Bastion host)

The project you’re using to install the various services that make up the Destinasia application are located on this host. To access it will require you ssh into as the root user:

$ ssh root@workstation-<YOUR-GUID>.rhpds.opentlc.com
$ cd rhcs-travel-agency-demo

Here you will find the following structure:

  • Dockerfile

  • docs/

  • init.sh

  • installs/

  • Readme.md

  • support/

You can browse the Readme.md file for details of the contents, but for now you only need to take the first step. You will be installing the first container, with JBoss BPM Suite.

3.2. Build and deploy JBoss BRMS with travel discount rules project

To start a container build and eventual deployment of this project you need only to pass the host name to the 'init.sh' as follows:

$ ./init.sh master.example.com

The console will show you the output and just follow along as the project is sent to build on OpenShift. At the same time, log in to the OpenShift console and watch the build:

https://workstation-<YOUR-GUID>.rhpds.opentlc.com:8443
user: admin
pass: r3dh4t1!

You will find a new project has been created called 'appdev-in-cloud', click on this to view the container builds and deployments in the rest of this lab. For more details select the 'Monitoring' tab.

The 'init.sh' running in the console will finish with output like this:

===================================================================================
=                                                                                 =
=  Login to JBoss BRMS to start developing rules projects, something like:        =
=                                                                                 =
=   http://workstation-<YOUR-GUID>.rhpds.opentlc.com:8080/business-central        =
=                                                                                 =
=   [ u:erics / p:jbossbrms1! ]                                                   =
=                                                                                 =
=  Access the online Travel Agnecy booking web application at:                    =
=                                                                                 =
=   http://workstation-<YOUR-GUID>.rhpds.opentlc.com/external-client-ui-form-1.0  =
=                                                                                 =
=  Note: it takes a few minutes to expose the service...                          =
=                                                                                 =
===================================================================================

Note: An online step-by-step lab is available, see this for details and screenshots of this installation:

3.2.1. Explore the Travel Agency process project

View online step-by-step lab for this section of the workshop containing details and screenshots for exploring the project:

3.3. Explore the Travel Agency domain model

In the project 'Authoring' → 'Project Authoring', locate the domain model in the 'Project Explorer' on the right, browsing down into the project to '<default>.org.specialtripsagency'. A menu entry in 'Project Explorer' appears titled 'Data Objects', click to drop-down the objects:

  • Applicant

  • BookingObject

  • Flight

  • Hotel

  • PaymentDetails

  • Rejection

  • TravelDetails

Explore these object to get an idea of what the domain modeller looks like and what’s in this project.

Note: An online step-by-step lab is available showing how the domain model was created, details and screenshots:

3.4. Explore the Travel Agency data validation guided rules

In the project 'Authoring' → 'Project Authoring', locate the guided rules in the 'Project Explorer' on the right, browsing to the project '<default>' level. Various drop-down menus appear in 'Project Explorer'. Click on 'Guided Rules' to open the list of rules.

Explore these and feel free to create a new one based on an existing or follow one of the online step-by-step instructions showing how these rules were created, details and screenshots:

3.5. Explore the Travel Agency data validation technical rules (coming soon…​)

In the project 'Authoring' → 'Project Authoring', locate the technical rules in the 'Project Explorer' on the right, browsing to the project '<default>' level. Various drop-down menus appear in 'Project Explorer'. Click on 'DRL' (Drools Rule Language) to open the list of technical rules.

  • CalculateTotalPriceBasedOnDiscountProvided

  • ObjectValidation

Explore these and feel free to create a new one based on an existing or follow one of the online step-by-step instructions showing how these rules were created, details and screenshots:

3.6. Explore the Travel Agency guided decision table (coming soon…​)

3.7. Explore the Travel Agency user task forms (coming soon…​)

3.8. Explore the Travel Agency business processes (coming soon…​)

3.9. Explore the Travel Agency external web front-end application (coming soon…​)

3.10. Running the Travel Agency booking application

After touring all the parts of this process driven application, it’s time to build and deploy it for use. This can be done by going to the project using menus 'Authoring' → 'Project Authoring' → clicking on button within the 'Project Explorer' labelled 'Open Project Editor'. The project details are opened in the right pane. Open the 'Build' menu in the top right corner by clicking on it, choose 'Build & Deploy' and you should se a green pop-up after a bit that states 'Build successful'.

View the deployed process project by clicking on 'Process Management' → 'Process Definitions' and locate the three processes that should be ready for use:

  • specialtripsagencyprocess

  • calculatepriceprocess

  • compensateService

To start submitting a travel booking, open the front-end web UI in a separate browser tab:

`http://workstation-<YOUR-GUID>.rhpds.opentlc.com/external-client-ui-form-1.0`

Fill in the following fields with data:

  • Applicant Name: [your-name]

  • Email Address: [any-email]

  • Number of Travellers: 2

  • From Destination: London

  • To Destination: Edinburgh

  • Preferred Date of Departure: 2018-12-20

  • Preferred Data of Arrival: 2018-12-29

  • Other Details / Notes: [any-text]

Click on submit button and you’ll see the following appear in green as a successful submitted booking:

`Thank you for filling out the form. Your request has been processed successfully!`
`Your Unique Process ID is: [1]`
`Our team will get in touch with you shortly with a Quote.`

Go back to the JBoss BPM Suite project browser tab and open the process instance list by clicking on the menus 'Process Management' → 'Process Instances' and note the default view selects the 'Completed' listing. You’ll see a completed process 'calculatepriceprocess' which you click on to select, view the details in pane on right, then click on button in top right labeled 'Options' → 'Process Model' to view completed process shown by each node being greyed out. Close the process viewer by clicking on the 'OK' button.

In the left pane labeled 'Process Instances', click on the tab 'Active' to view active process instances, note your instance 'specialtripsagencyprocess' is still running, but in what state is it? Click on it to select and view the details in the right pane, noting that it’s 'Instance State: Active'. Let’s get a visual indication of where the process is at by clicking on button in top right labeled 'Options' → 'Process Model' to view the model, noting that it’s waiting in 'Employee Booking' node shown outlined in red, which is a user task. Let’s go claim that task and complete the work before submitting it. Close the process viewer by clicking on the 'OK' button.

Open the user task list by clicking on the 'Task' menu item at the top. An entry labeled 'Employee Booking' is waiting for someone to claim it. Do this by clicking on the 'Claim' button, this opens the Employee Booking user task form in the pane on the right, with fields containing process data for review. You have three options at the bottom of the form:

  • Option 1 - Send for review (sending it back to management review)

  • Option 2 - Booking confirmed (accept and pass onwards)

  • Option 3 - Booking cancelled (reject booking)

We’ll be accepting the booking so filling in the fields for 'Option 2':

  • check the box to confirm the booking

  • Credit Card: 1111111111 (note any card starting with 1234 will cause the compensation feature to roll back the booking later in the process.

  • Expiry Date (MM/YY): 08/20

  • Name of CC Holder: [your-name]

Click on the 'Complete' button at the bottom of the form to finish this task.

Now to view the process instance and see that it has completed, open the process instance list by clicking on the menus 'Process Management' → 'Process Instances' and see the 'Active' listing is now empty. Select the 'Completed' tab to find your three completed process instances. Click on 'specialtripsagencyprocess' to select and view the details in the right pane, noting that it’s 'Instance State: Completed'. Let’s get a visual indication of where the process is at by clicking on button in top right labeled 'Options' → 'Process Model' to view the model, noting that it’s greyed out path is all the way to 'Booking completed' end state.

Now you are capable of searching for the completed process 'compensateService' and viewing the path it took to its completed state, do that now. Note that it booked hotels and flights before charging the credit card and sending an email before ending in 'Payment received' state.

You have now submitted a successful travel booking! Now go back and start a new instance where you take different actions, like rejecting a travel booking, or paying with a credit card using the number 1234111111.

Have fun!

4. Conclusion

This concludes the demo workshop for this AppDev in the Cloud example application.