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.

Registering for Notification [Specifying Subscription Name—Multiconsumer Queue]<br />

{<br />

text *subname;<br />

ub4 size;<br />

ub4 *number = (ub4 *)ctx;<br />

text *queue;<br />

text *consumer;<br />

OCIRaw *msgid;<br />

OCIAQMsgProperties *msgprop;<br />

(*number)++;<br />

/* Get the subscription name */<br />

OCIAttrGet((dvoid *)subscrhp, OCI_HTYPE_SUBSCRIPTION,<br />

(dvoid *)&subname, &size,<br />

OCI_ATTR_SUBSCR_NAME, errhp);<br />

printf("got notification number %d for %.*s %d \n",<br />

*number, size, subname, payl);<br />

/* Get the queue name from the AQ notify descriptor */<br />

OCIAttrGet(desc, OCI_DTYPE_AQNFY_DESCRIPTOR, (dvoid *)&queue, &size,<br />

OCI_ATTR_QUEUE_NAME, errhp);<br />

/* Get the consumer name for which this notification was received */<br />

OCIAttrGet(desc, OCI_DTYPE_AQNFY_DESCRIPTOR, (dvoid *)&consumer, &size,<br />

OCI_ATTR_CONSUMER_NAME, errhp);<br />

/* Get the message id of the message for which we were notified */<br />

OCIAttrGet(desc, OCI_DTYPE_AQNFY_DESCRIPTOR, (dvoid *)&msgid, &size,<br />

OCI_ATTR_NFY_MSGID, errhp);<br />

/* Get the message properties of the message for which we were notified */<br />

OCIAttrGet(desc, OCI_DTYPE_AQNFY_DESCRIPTOR, (dvoid *)&msgprop, &size,<br />

OCI_ATTR_MSG_PROP, errhp);<br />

}<br />

int main(argc, argv)<br />

int argc;<br />

char *argv[];<br />

{<br />

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

/* The subscription handles */<br />

OCISubscription *subscrhp[5];<br />

Operational Interface: Basic Operations 11-61

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

Saved successfully!

Ooh no, something went wrong!