[Orclib-users] Problem with advancedQues
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
From: Hayyan R. <hay...@ho...> - 2011-02-13 08:32:49
|
Hi I just started using OCILIB and so far I just got it to unblock whenever there is an object in my Queues. Here is what really happens when the queue is empty my_msg = OCI_DequeueGet(MyDeque); Blocks as it should however when I insert something into the Queue the above procedure unblocks however my_msg is still NULL. Any idea what i could be doing wrong here ?? The code which i wrote is given below:: OCI_Connection *con; OCI_Agent *MyAgent; OCI_Agent *RetAgent; OCI_Dequeue *MyDeque; OCI_TypeInfo *Typeinf; boolean ConsRet; boolean AgentSet; OCI_Msg *my_msg; boolean BoolDequeueSetAgentList; boolean DeqMode; boolean set_msg; OCI_Object *MyObj; OCI_Initialize(NULL, NULL,OCI_ENV_DEFAULT); //OCI_ENV_CONTEXT OCI_ENV_DEFAULT con = OCI_ConnectionCreate(ConnString , username, pass, OCI_SESSION_DEFAULT); //Create Agent which holds the consumer Name MyAgent = OCI_AgentCreate(con,AgentName,AgentAddress); //Agent Name = ULTRADBA Address=ULTRADBA.ACT_Q //OK //Set The Agent Name AgentSet = OCI_AgentSetName(MyAgent,AgentName); //OKAY //AgentName //Create a Type Info Indicating Object Payload Typeinf = OCI_TypeInfoGet(con,"ULTRADBA.ACTIVITY_DET_QMSG",OCI_TIF_TYPE); //Okay //Use OCI_DequeueCreate To Initialize Dequeing MyDeque = OCI_DequeueCreate(Typeinf, QueueName); ///NOT SURE //QUEUE NAME //OCI_DequeueSetAgentList Attach agent with deque BoolDequeueSetAgentList = OCI_DequeueSetAgentList(MyDeque,&MyAgent,1); //OK //ConsRet Set Consumer ConsRet = OCI_DequeueSetConsumer(MyDeque,NULL); //OKAY printf("Starting Listening To Messages \n"); //Listen For Messages Using OCI_DequeueListen RetAgent = OCI_DequeueListen(MyDeque,80); //Agent Address Returned //OCI_DequeueSetWaitTime(MyDeque,200); //OKAY ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////SETUP THE MESSAGE////////////////////////////////////// my_msg = OCI_MsgCreate(Typeinf); MyObj = OCI_ObjectCreate(con, Typeinf); set_msg = OCI_MsgSetObject(my_msg,MyObj); OCI_MsgFree(my_msg); ////////////////////////////////////////////////////////////////////////////////////////// //DeqMode= OCI_DequeueSetMode(MyDeque,OCI_ADM_REMOVE ); my_msg = OCI_DequeueGet(MyDeque); //Blocking Call MyObj = OCI_MsgGetObject(my_msg); //Get Consumer Name using OCI_DequeueGetConsumer // printf("Messages Received \n"); ///================================================================================ ////=============================================================================== /////============================================================================== printf("Consumer Name %s",OCI_DequeueGetConsumer(MyDeque)); Any help would be appreciated... Thanks |