09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

General Features of <strong>Advanced</strong> <strong>Queuing</strong><br />

}<br />

if (lcorrelation == strlen(logon) && /* logon event */<br />

!memcmp((dvoid *)correlation, (dvoid *)logon, strlen(logon)))<br />

{<br />

user_count[appno].logon++;<br />

/* increment logon count for the app process */<br />

printf("Logon by APP%d \n", (appno+1));<br />

printf("Logon Payload length = %d \n", pay1);<br />

}<br />

else if (lcorrelation == strlen(logoff) && /* logoff event */<br />

!memcmp((dvoid *)correlation,(dvoid *)logoff, strlen(logoff)))<br />

{<br />

user_count[appno].logoff++;<br />

/* increment logoff count for the app process */<br />

printf("Logoff by APP%d \n", (appno+1));<br />

printf("Logoff Payload length = %d \n", pay1);<br />

}<br />

else /* correlation is "LOGON" or "LOGOFF" */<br />

printf("Wrong correlation in notification");<br />

printf("Total : \n");<br />

printf("App1 : %d \n", user_count[0].logon-user_count[0].logoff);<br />

printf("App2 : %d \n", user_count[1].logon-user_count[1].logoff);<br />

printf("App3 : %d \n", user_count[2].logon-user_count[2].logoff);<br />

int main(argc, argv)<br />

int argc;<br />

char *argv[];<br />

{<br />

OCISession *authp = (OCISession *) 0;<br />

OCISubscription *subscrhp[3];<br />

ub4 namespace = OCI_SUBSCR_NAMESPACE_AQ;<br />

process_statistics ctx[3] = {{0,0}, {0,0}, {0,0}};<br />

ub4 sleep_time = 0;<br />

printf("Initializing OCI Process\n");<br />

/* Initialize OCI environment with OCI_EVENTS flag set: */<br />

(void) OCIInitialize((ub4) OCI_EVENTS|OCI_OBJECT, (dvoid *)0,<br />

(dvoid * (*)(dvoid *, size_t)) 0,<br />

(dvoid * (*)(dvoid *, dvoid *, size_t))0,<br />

(void (*)(dvoid *, dvoid *)) 0 );<br />

8-22 <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!