CSC 513 Programming Assignment 4
Message Queue

 Description | JBoss | JMS | | Deliverable | Resources


Update

4/4/2009    Please check here for how to get the Java example for JBoss 4.2.1 running.

3/31/2009  Added instructions for accessing Campus Oracle DB Server.

3/31/2009  Changed the project requirement a bit. You will need to write a xquery script to process the incoming xml message as indicated in task (2).

 

Description

Consider the scenario below.

image002

An E-Commerce website, like the simple website we built for Project 1, sends the book orders in an XML format (assume all books order XML files conform to this schema) to a Message Queue for backend processing. The Message Queue keeps the messages received from the E-Commerce website.  A backend java program reads an incoming order from the Message Queue, parses its contents, and based on a query to its database, decides where to forward the order.

 

You will need to write the backend Java program to do the following tasks:

(1)   Read xml message (book orders) from Message Queue

(2)   Run a simple .xq script against the incoming order to get book ids. You can write the .xq as you want, but you will need to run it programmatically in the java program.

(3)   Query the stock database to check if all the books in the order exist in the stock

(4)   If all the books in the book order has copy in stock, print TYPE A message, like, “All BOOKS IN THE ORDER ARE IN STOCK” 

(5)   If not, print TYPE B message, for example, “SOME BOOKS IN THE ORDER ARE NOT IN STOCK”

 

Must Read:

* You will need to install JBoss for the message queue, see instructions below.     

     * There is a good tutorial regarding how java program communicate with message queue JBoss 4.04 Application Server Guide

* At first, the JBoss message queue is empty; you can use your java program to send a book order (for example, book-order) to the message queue (simulating the E-Commerce website order submission).  Then the Message queue has some message, your java program can retrieve the message and do other tasks.

     * Assume all book order XML files conform to this schema.

* You will need to set up the stock database using on Campus Oracle server (instructions). The DB content should be initialized to the content below. (here is a script for your convenience)

 

book-id

num_of_copies

1

10

2

10

3

10

4

10

5

10

6

10

7

10

 

Campus Oracle DB Server

Instructions can be found at http://www.csc.ncsu.edu/techsupport/technotes/oracle.php

Accessing campus Oracle DB server instructions can be found here.

JBoss

Here are the instructions to setup JBoss.

  1. Download jboss-4.2.1.GA.zip and unzip it.  (You are free to use a newer version, if you have problem with this version)
  2. To start JBoss application server, execute
jboss-4.2.1.GA\bin\run
  1. Open the browser and go to the JBoss start page http://127.0.0.1:8080/ or http://localhost:8080/.
  2. If you don't see the JBoss start page, something is wrong. Check the messages JBoss output on startup or JBoss FAQ Wiki for more info.

Java Message Service (JMS)

Deliverable

Resources

  1. Java Tutorial (if you are not familiar with Java)
  2. J2EE 1.4 Tutorial
  3. JBoss FAQ Wiki

Last Update: March 27, 2009
Xibin Gao (xgao2@ncsu.edu)