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.

Enqueuing and Dequeuing Of Messages<br />

Enqueuing and Dequeuing of Messages by Correlation and Message ID Using<br />

Pro*C/C++<br />

Note: You may need to set up data structures similar to the<br />

following for certain examples to work:<br />

$ cat >> message.typ<br />

case=lower<br />

type aq.message_typ<br />

$<br />

$ ott userid=aq/aq intyp=message.typ outtyp=message_o.typ \<br />

code=c hfile=demo.h<br />

$<br />

$ proc intyp=message_o.typ iname= \<br />

config= SQLCHECK=SEMANTICS userid=aq/aq<br />

#include <br />

#include <br />

#include <br />

#include <br />

/* The header file generated by processing<br />

object type ’aq.Message_typ’: */<br />

#include "pceg.h"<br />

void sql_error(msg)<br />

char *msg;<br />

{<br />

EXEC SQL WHENEVER SQLERROR CONTINUE;<br />

printf("%s\n", msg);<br />

printf("\n% .800s \n", sqlca.sqlerrm.sqlerrmc);<br />

EXEC SQL ROLLBACK WORK RELEASE;<br />

exit(1);<br />

}<br />

main()<br />

{<br />

LNOCIEnv *oeh; /* OCI Env Handle */<br />

LNOCIError *err; /* OCI Error Handle */<br />

Message_typ *message = (Message_typ*)0; /* queue payload */<br />

message_type_ind *imsg; /*payload indicator*/<br />

LNOCIRaw *msgid = (OCIRaw*)0; /* message id */<br />

ub1 msgmem[16]=""; /* memory for msgid */<br />

char user[60]="aq/AQ"; /* user login password */<br />

A-38 <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!