O'Reilly - Java Message Service by Richard Monson-Haefel & David A. Chappell

O'Reilly - Java Message Service by Richard Monson-Haefel & David A. Chappell

Author:Richard Monson-Haefel & David A. Chappell [Monson-Haefel, Richard & Chappell, David A.]
Language: eng
Format: epub, pdf
Tags: creating distributed enterprise applications
Published: 2011-10-04T19:40:11.553823+00:00


Java Message Service

QWholesaler and QRetailer applications in separate command windows using the following command-line options:

java chap6.B2B.QWholesaler localhost username password java chap6.B2B.QRetailer localhost username password

In the QWholesaler application, enter the following two lines at the prompt (Item description, Old Price, New Price):

Surfboards, 999.99, 499.99

Wetsuits, 299.99, 149.99

The QRetailer application does not respond with a "Buy Order" until you hit the Enter key on the second line-item, because QRetailer knows that it can't buy 1000 surfboards without also buying 1000 wetsuits to go with them. Here is the code for the autoBuy( ) method, which contains this logic:

private void autoBuy (javax.jms.Message message){

int count = 1000;

try {

StreamMessage strmMsg = (StreamMessage)message;

String dealDesc = strmMsg.readString( );

String itemDesc = strmMsg.readString( );

float oldPrice = strmMsg.readFloat( );

float newPrice = strmMsg.readFloat( );

System.out.println( "Received Hot Buy: "+dealDesc );



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.