![]() | ![]() |
Home |
|
|
Sybase dbQueue User's Guide |
|
| Chapter 5: Java Queuing Tool |
This chapter contains the following topics:
The Java queuing tool can enqueue and dequeue messages to and from visible dbQueue queues. It runs from a Java-enabled browser (such as Netscape) to access queues in an existing dbQueue system. Its graphical user interface lets you enter data for each field in the selected message type and then enqueue the message. It can also retrieve messages from the selected queues and displays the data. You can reload catalog information if you have reconfigured your system.
The tool accesses an HTML file located in the java subdirectory of the dbQueue release directory.
To run the tool, you need:
Note: The Java queuing tool (Queue.class) requires the CLASSPATH environment variable to be set to $DBQ/java/syb102.zip:$DBQ/java on UNIX or %DBQ%\java\syb102.zip; %DBQ%\java on NT.
The javademo and dbqtool utility automatically set CLASSPATH. On some installations, Netscape may be implemented as a script that ignores CLASSPATH and sets it to a different value. The Java queuing tool does not run with such scripts because it cannot find the required classes. You must modify the script (through your system administrator) or modify a local copy of the script. If you make a local copy, make sure it appears at the beginning of your PATH environment variable.
The Java queuing tool can connect to a preconfigured demo database or any existing dbQueue queues.
A SQL Anywhere engine starts for the preconfigured "javademo" datasource and a preconfigured gateway that the queuing tool will use to access the datasource. It also opens a preconfigured javademo.html file in your Java-enabled Netscape browser.
The "Data Source" list box has one entry ("javademo"). The message types list box has "Coffee" and "Pizza," which are available for the source queue Orders and target queue Dispatch. The data entry fields change to reflect the selected message type.
The Java queuing tool displays three message types ("Coffee," "Pizza," and "Types"), one application database ("javademo"), three queues in that database (Dispatch, Orders, and Demo), one QTM ("qtm"), and one transfer ("Orders_Dispatch").
To start the Java queuing tool to work with other queues:
<APPLET CODE=Queue.class WIDTH=600 HEIGHT=500>You may want to save a read-only copy of the Queue.html file as a template.
<PARAM NAME="server" VALUE="buzz">
<PARAM NAME="port" VALUE="5000">
<PARAM NAME="database" VALUE="dbq_catalog">
</APPLET>
If you are not using Netscape, you can:
set CLASSPATH = %DBQ%\java\syb102.zip;%DBQ%\java;%CLASSPATH%
To connect to a SQL Anywhere database, you need to use the gateway as follows:
[dbq_catalog]If you use more than one database, you must create a separate entry for each database. Each entry must have a different port number.
query=NLWNSCK,spring,5000
master=NLWNSCK,spring,5000
start dbos50 -d dbq_catalog dbq_catalog
WARNING! If you plan to use SQL Anywhere, you must create entries for the gateways before adding any dbQueue data sources to your dbQueue domain (either programmatically or by using Sybase Central ). To use this queuing tool, the gateways must be running. The queuing tool contacts the SQL Anywhere databases through these gateways.
The Java queuing tool can connect to a preconfigured demo database or any existing dbQueue queues.
Run the supplied scripts to create the javademo database in a SQL Server and populate it with a catalog, queues, messages types, and transfers.
cd $DBQ/java
javademo_setup [password]where password is the password for the user sa in the SQL Server. The default password for sa is the ""value.
javademo_setup installs a javademo database on the server and populates it with sample data. You only need to run javademo_setup once.
javademo_setup adds the message types "Coffee" and "Pizza," the source queue Orders, the target queue Dispatch, the QTM "qtm," and the transfer "Orders_Dispatch" to the javademo database.
$DBQ/bin/qtm -s qtm
javademoThe Java queuing tool starts in Netscape and connects to the javademo database. See Running the Java Queuing Tool and Using the Interface.
To start the Java queuing tool to work with other datasources and queues:
<APPLET CODE=Queue.class WIDTH=600 HEIGHT=500>You may want to save a read-only copy of the Queue.html file as a template.
<PARAM NAME="server" VALUE="buzz">
<PARAM NAME="port" VALUE="5000">
<PARAM NAME="database" VALUE="dbq_catalog">
</APPLET>
If you are not using Netscape, you can:
set CLASSPATH = $DBQ/java/syb102.zip:$DBQ/java;$CLASSPATH
Note: If you encounter problems loading the tool (due to, for example, incorrect paths, incorrectly set environment variables, or permission problems), exit Netscape and restart it after you have resolved the problem. Simply clicking on Reload in Netscape does not apply the changes.
You can enqueue and dequeue messages to the Dispatch queue. If "qtm" is running, you can also enqueue to the Orders queue and dequeue from the Dispatch queue.
Depending on how messages and queues are configured, messages of different types may be enqueued to the same queue. Messages are retrieved in the same order in which they were submitted, regardless of type.
Once you start the tool, you see the dbQueue Queue Interface web page. It contains selections for a Submit Window, a Fetch Window, a Catalog Reload window, datasource, queue, message type, and data fields that correspond to the selected message type.
Figure 5-1: dbQueue Queue Interface web page
To enqueue a message:
Data fields corresponding to the selected message type appear.
A status window appears showing the status of the enqueue operation. If you are queuing to SQL Anywhere, the status displayed may not be an accurate representation of the actual status because the gateway may filter the return message.
To dequeue a message:
Message types corresponding to the selected queue appear and data fields corresponding to the message type appear.
If you made any changes to the system , click on Catalog Reload to apply the changes.
|
|