09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Asynchronous Notifications<br />

Scenario<br />

In the BooksOnLine application, a customer can request Fed-Ex shipping (priority<br />

1), priority air shipping (priority 2), or regular ground shipping (priority 3).<br />

The shipping application then ships the orders according to the user's request. It is<br />

of interest to BooksOnLine to find out how many requests of each shipping type<br />

come in each day. The application uses asynchronous notification facility for this<br />

purpose. It registers for notification on the WS.WS_bookedorders_que. When it<br />

is notified of new message in the queue, it updates the count for the appropriate<br />

shipping type depending on the priority of the message.<br />

Visual Basic (OO4O): Example Code<br />

Refer to the Visual Basic online help, "Monitoring Messages".<br />

Java (JDBC): Example Code<br />

This feature is not supported by the Java API.<br />

C (OCI): Example Code<br />

This example illustrates the use of OCIRegister. At the shipping site, an OCI client<br />

program keeps track of how many orders were made for each of the shipping types,<br />

FEDEX, AIR and GROUND. The priority field of the message enables us to<br />

determine the type of shipping desired.<br />

#include <br />

#include <br />

#include <br />

#include <br />

#ifdef WIN32COMMON<br />

#define sleep(x) Sleep(1000*(x))<br />

#endif<br />

static text *username = (text *) "WS";<br />

static text *password = (text *) "WS";<br />

static OCIEnv *envhp;<br />

static OCIServer *srvhp;<br />

static OCIError *errhp;<br />

static OCISvcCtx *svchp;<br />

static void checkerr(/*_ OCIError *errhp, sword status _*/);<br />

struct ship_data<br />

{<br />

8-98 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!