OCI_Agent * OCI_API OCI_MsgGetSender ( OCI_Msg *msg ) { boolean res = TRUE; OCIAQAgent *handle = NULL; OCI_Agent *sender = NULL; OCI_CHECK_PTR(OCI_IPC_MSG, msg, NULL); OCI_CALL2 ( res, msg->typinf->con, OCIAttrGet((dvoid *) msg->proph, (ub4 ) OCI_DTYPE_AQMSG_PROPERTIES, (dvoid *) &handle, (ub4 ) 0, (ub4 ) OCI_ATTR_SENDER_ID, msg->typinf->con->err) ) if ((res == TRUE) && (handle != NULL)) { sender = OCI_AgentInit(msg->typinf->con, &msg->sender, handle, NULL, NULL); } OCI_RESULT(res); return sender; }
OCI_Agent * OCI_API OCI_DequeueListen ( OCI_Dequeue *dequeue, int timeout ) { boolean res = TRUE; OCI_Agent *agent = NULL; OCIAQAgent *handle = NULL; OCI_CHECK_PTR(OCI_IPC_DEQUEUE, dequeue, NULL); /* listen only if OCI_DequeueSetAgentList has been called */ if (dequeue->agent_list != NULL) { sword ret; sb4 code = OCI_SUCCESS; ret = OCIAQListen(dequeue->typinf->con->cxt, dequeue->typinf->con->err, dequeue->agent_list, (ub4) dequeue->agent_count, (sb4) timeout, &handle, OCI_DEFAULT); /* check returned error code */ if (ret == OCI_ERROR) { OCIErrorGet((dvoid *) dequeue->typinf->con->err, (ub4) 1, (OraText *) NULL, &code, (OraText *) NULL, (ub4) 0, (ub4) OCI_HTYPE_ERROR); /* raise error only if the call has not been timed out */ if (code != OCI_ERR_AQ_LISTEN_TIMEOUT) { OCI_ExceptionOCI(dequeue->typinf->con->err, dequeue->typinf->con, NULL, FALSE); res = FALSE; } } /* init local agent object */ if ((res == TRUE) && (ret == OCI_SUCCESS) && (handle != NULL)) { agent = OCI_AgentInit(dequeue->typinf->con, &dequeue->agent, handle, NULL, NULL); } } OCI_RESULT(res); return agent; }