ITrade is an equity trading system utilizing BambooPipe message queue. It consists of a Java applet and two Java applications. The applet serves as user interface. The applications are service providers for the applet. One of the applications, NewsService, provides news update for ticker tape. The other one, DBService, provides database operation service.
Note: Itrade is provided as an example application. Both service applications provide testing service data.
Traders can use the system to collaborate on trading as long as they have access to a browser, no matter where they are. They have the ability to send messages to each other and to receive real time transaction updates from each other.
First section of this document explains how to start and use the system. Second section discusses Implementation details.
ITrade is part of BambooPipe download. All commands needed to start the system on Windows 95/Windows NT are included in "cmd" subdirectory.
Step 1: start RMI registry
start rmiregistry
Step 2: start BambooPipe server
cd cmd
startPipe_nt
Wait until "register OK" message appears in startPipe_nt’s console window.
Step 3: start Java application News Service
startNewsService_nt
Step 4: start Java application DB Service
startDBService_nt
Step 5: start applet for two different traders
start appletviewer itrader1.html
start appletviewer itrader2.html
Figure 1 and Figure 2 show the applet running for trader1 and trader2.
Figure 1
Figure 2
At the top of the applet, a ticker tape displays recent news from NewsService. The blinking orange light at upper-right corner announces major news as showed in Figure 1.
At the bottom of the applet, traders can send messages to each other.
Trading
Portfolios are displayed in a tree structure where positions are leaf nodes. Clicking on a position displays its associated trades in the transaction box. Clicking on a trade brings it into editing box where it can be modified.
Because of asynchronous nature of ITrade, trades can be in one of four states: Ok, Error, Pending Save and Pending Del. After initialization, all trades are in Ok state. If a trade is saved but DBService hasn't replied to the save request, the trade is in Pending Save state. Similarly, a deleted trade without DBService reply is in Pending Del. After receiving DBService reply, the pending state will become "OK" or "Error" accordingly.
"Graphic/Trans" toggle button allows users to switch between trade listing and account composition chart. "Refresh" Button requests an initialization from DBService.
News queue is for news messages displayed in ticker tape. NewsService is the sole producer and applets are consumers.
Trader message queue is for real time message exchange between traders. Applets are both producers and consumers.
DB message queue is for transaction processing. Applets post DB requests. DBService listens for requests and posts replies. Applets also listen for both request and reply messages to update trade state accordingly. DBService is the mandatory consumer of the queue. That means if DBService is down, the queue will hold the requests until it comes back.
Fault Tolerance Test
Because of the guaranteed delivery feature of BambooPipe, this system is much more robust than a two tier client-server system.
For example, let's kill DBService and save some changes for a trade. Besides the fact that the trade stays in Pending Save state, the applet acts perfectly normal. Because queue is buffering DB request, the applet is isolated from the DBService problem.
Now let's restart DBService. In startup process, DBService picks up all requests since shutdown. The trade becomes OK after the applet receives positive reply from DBService.
Java three tier applications like ITrade have two unique features that
make them perfectly suitable for Internet/Intranet: universal accessibility
and fault tolerance. BambooPipe provides a solid foundation for this type
of application.