This discussion is archived
8 Replies Latest reply: Jan 2, 2013 11:25 PM by 970843 RSS

Exception while dequeuing message

970843 Newbie
Currently Being Moderated
Hi,

I am getting an error sayin

"Exception while dequeuing message : Dequeue error in AQ object, ORA-25215: user_
data type and queue type do not match"

What will be the problem?Please help me with solution.

Thanks in advance
  • 1. Re: Exception while dequeuing message
    758358 Pro
    Currently Being Moderated
    Hi,

    You need to DQ using an object type that matches that of the target queue:

    oerr ora 25215
    25215, 00000, "user_data type and queue type do not match"
    *Cause: A user tries to enqueue an object to a queue that was created for objects of different type.
    *Action: Try enqueue again with an object of the right type.

    Check the payload type of the queue (against your queue name) and compare it to the object type you have in the DQ code:
    select dqt.owner,dqt.queue_table,dq.name,dqt.type,dqt.object_type 
     from dba_queue_tables dqt 
       join dba_queues dq 
        on dqt.owner = dq.owner 
       and dqt.queue_table  = dq.queue_table 
    where dq.name = '&QNAME';
    Hope that helps,
    Paul
  • 2. Re: Exception while dequeuing message
    970843 Newbie
    Currently Being Moderated
    This is the link i am following for enqueuing the message into a queue table, its happening successfully.

    http://www.oratechinfo.co.uk/aq.html

    I can see the message i enqueued in the queue table with the following query at the scheduled time.
    select user_data from queue_table;

    Below is the C++ code to dequeue the msg.In DequeueObject() function on this particular line "msgid = oaq.Dequeue();"
    the control moves to console which not proceeding further.I am wondering what went wrong.


    //This is a simple program showing how to call oo4o api from a mulithreaded application.
    //Note that every thread has its own OStartup() and OShutdown() routines.

    // PROJECT SETTINGS : Under C/C++ option, make sure the project options is /MT for release
    // or /MTd for debug(NOT /ML or /MLd).


    #include "windows.h"
    #include "stdio.h"
    #include <iostream>
    #include <process.h>          
    #include <oracl.h>

    using namespace std;

    OSession osess ;
    int DequeueRaw();
    int DequeueObject();

    int main(int argc, char **argv)
    {
         int retVal = 0;

         OStartup(OSTARTUP_MULTITHREADED);
         // create session object for each thread. This gives maximum
         // concurrency to the thread execution. This is also useful when OO4O
         // error reported on session object for one thread cannot be seen by
         // another thread.
         try
         {
              osess.Open();
              
              if ( ! osess.IsOpen() )
              {
                   cout << "Session not opened: Error: " << osess.GetErrorText() << endl;
                   
                   osess.Close();
                   OShutdown();
                   return -1;
              }
         //     retVal = DequeueRaw();
              retVal = DequeueObject();
         }
         catch(OException oerr)
         {
              cout << "Exception while dequeuing message : " << oerr.GetErrorText() << endl;
              retVal = -1;
         }
         return retVal;
    }

    // This function dequeues a message of default type(string of characters)
    // from the raw_msg_queue.
    // Gets the message priority after dequeuing
    // Checks if any message with correlation like 'AQ' is available on the queue.
    int DequeueRaw()
    {
         ODatabase odb;
         OAQ oaq;
         OAQMsg oaqmsg;
         OValue msg;
         const char *msgid = 0;

         odb.Open(osess, "MICROSOFT", "OMNIPOS", "OMNIPOS");
         if ( ! odb.IsOpen() )
         {
              cout << "Database not opened: " << odb.GetErrorText() << endl;
              odb.Close();
              return(-1);
         }

         // Open the 'raw_msg_queue'
         oaq.Open(odb,"example_queue");
         if( !oaq.IsOpen())
         {
              cout << "AQ not opened: " << oaq.GetErrorText() << endl;
              return(-1);
         }
         
         // Get an instance of the default message(of RAW type)
         oaqmsg.Open(oaq);
         if( !oaqmsg.IsOpen() )
         {
              cout << "AQMsg not opened: " << oaqmsg.GetErrorText() << endl;
              return(-1);

         }

         // Dequeue a message
         //msgid = oaq.Dequeue();
         //if (msgid )
         //{
         //     // Retrieve the message attributes
         //     oaqmsg.GetValue(&msg);
         //     const char *msgval = msg;
         //     cout << "Message '" << msgval <<
         //          "' dequeued at priority : " << oaqmsg.GetPriority() << endl;
         //}
         
         // Dequeue message with correlation like "AQ"
         oaq.SetCorrelate("%AQ%");
         oaq.SetDequeueMode(3);
         msgid = oaq.Dequeue();
         if (msgid )
         {
              // Retrieve the message attributes
              char msgval[101];
              long len = oaqmsg.GetValue(msgval,100);
              msgval[len] = '\0';
              cout << "Message '" << msgval <<
                   "' dequeued at priority : " << oaqmsg.GetPriority() << endl;
         }

         // Close all of the objects
         oaqmsg.Close();
         oaq.Close();
         odb.Close();
         return 0;
    }

    // This function dequeues a message of user-defined type MESSAGE_TYPE
    // from the msg_queue.
    // Gets the message priority after dequeuing
    // Checks if any message with correlation like 'SCOTT' is available on the queue.
    int DequeueObject()
    {
         ODatabase odb;
         OAQ oaq;
         OAQMsg oaqmsg;
         const char *msgid = 0;
         OValue msg;
         char subject[255];
         char text[255];

         odb.Open(osess, "MICROSOFT", "OMNIPOS", "OMNIPOS");
         if ( ! odb.IsOpen() )
         {
              cout << "Database not opened: " << odb.GetErrorText() << endl;
              odb.Close();
              return(-1);
         }

         // Open the 'msg_queue'
         oaq.Open(odb,"example_queue");
         if( !oaq.IsOpen())
         {
              cout << "AQ not opened: " << oaq.GetErrorText() << endl;
              return(-1);
         }
         
         // Get an instance of the udt MESSAGE_TYPE (check out schema for details)

         oaqmsg.Open(oaq,1,"MESSAGE_TYPE");
         if( !oaqmsg.IsOpen() )
         {
              cout << "AQMsg not opened: " << oaqmsg.GetErrorText() << endl;
              return(-1);

         }

         // Dequeue message with correlation like "SCOTT"
         oaq.SetCorrelate("%OMNIPOS%");
         oaq.SetDequeueMode(3);
         msgid = oaq.Dequeue();
         if (msgid )
         {
              // Retrieve the message attributes
              // Get the subject,text attributes of the message
              OObject msgval;
              oaqmsg.GetValue(&msgval);
              msgval.GetAttrValue("subject", subject,255);     
              msgval.GetAttrValue("text", text,255);

              cout << "Message '" << (subject ? subject :"") << "' & Body : '" << text <<
                   "' dequeued at priority : " << oaqmsg.GetPriority() << endl;
              msgval.Close();
         }

         msgid = 0;
         oaq.SetNavigation(1);
         oaq.SetCorrelate("");

         // Dequeue a message
         msgid = oaq.Dequeue();
         if (msgid )
         {
              // Retrieve the message attributes
              OObject msgval;
              oaqmsg.GetValue(&msg);
              msgval = msg;          
              // Get the subject,text attributes of the message
              msgval.GetAttrValue("subject", subject,255);     
              msgval.GetAttrValue("text", text,255);

              cout << "Message '" << (subject ? subject :"") << "' & Body : '" << text <<
                   "' dequeued at priority : " << oaqmsg.GetPriority() << endl;
              msgval.Close();
         }
         

         // Close all of the objects
         msgid = NULL;
         msg.Clear();
         oaqmsg.Close();
         oaq.Close();
         odb.Close();
         return 0;

    }
  • 3. Re: Exception while dequeuing message
    758358 Pro
    Currently Being Moderated
    Hi,

    Well if you followed that link then it should work.

    I can't tell you what went wrong without seeing what you did - can you post exactly what you are running which fails and also the output from that last query I posted?

    Thanks
    Paul
  • 4. Re: Exception while dequeuing message
    970843 Newbie
    Currently Being Moderated
    i have updated my query
  • 5. Re: Exception while dequeuing message
    758358 Pro
    Currently Being Moderated
    Hi,

    Well I'm afraid I can't help you much debugging a c++ program !

    If the program fails with the error you originally posted then the issue is because the data type you are trying to DQ into doesn't match that which is on the queue (as I posted above).

    Check the data type of the queue against what you are trying to use in your code, it looks like you have the right type (looking through the c++ code) assuming you created the queue correctly as per that link.

    Thanks
    Paul
  • 6. Re: Exception while dequeuing message
    970843 Newbie
    Currently Being Moderated
    Do anyone have an idea about the use of SetCorrelate and SetDequeueMode in OAQ Object of OLE C++ class library.
  • 7. Re: Exception while dequeuing message
    970843 Newbie
    Currently Being Moderated
    Hi Paul,
    I re-do the same process from beginning now its happening.
  • 8. Re: Exception while dequeuing message
    970843 Newbie
    Currently Being Moderated
    Enqueuing and dequeuing happening sucessfully(i have above the method i used for enqueue and dequeue)but while dequeuing i am doing manually, how to do automatically dequeue a message by getting notification in my C++ code.

    Please give me a hand and clear.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points