Dequeue from Advanced Queue

Hi All,
I have used the DBMS_AQ package provided dequeue functionality for dequeuing msgs from my advanced queue. Now there is a job which dequeue the items from this queue and sends out email. Now what is happening is the job picks up an item from the advanced queue for dequeuing and sends out email, but the item which is picked up still remains in the queue and is not dequeued. As the job runs every minute and polls the queue, it again picks up the same queue item and sends the email. This process repeats for 5-6 times and then the queue message expires. My requirement is that, the job should dequeue the item from the queue and just send email once. Please can anyone suggest what could be the solution to this problem?

10g is not a version number it is a marketing label that applies equally to 10.1.0.2 and 10.2.0.4 and a lot of versions in between.
That said I know this demo I wrote works in all versions of 10.2:
http://www.psoug.org/reference/aq_demo1.html
Compare it to what you are doing.

Similar Messages

  • Dequeue from JMS Queue 10 at a time and process it.

    Hi,
    I have created a JMS queue in weblogic.
    Say i enqueue 1000 records in the queue at one go.
    Now, i want a bpel process to dequue from it and process it.
    However as per my requirement i want at a time 10 instances being active at a time i.e. 10 records from the queue are being processed at a time.
    Once any one of them finishes, the other will pick up the message.
    1 BPEL instance will process only 1 record from Q at a time
    Please let me know how to achieve this.

    You need to understand here that it is adapter which deques the message from queue and it will deliver it to BPEL for processing which is an async process. So adapter will keep dequeing messages and keep publishing it to BPEL irrespective of whether BPEL process has completed processing.
    You may need to tweak the adapter configuration here. First of all create the synchronous BPEL composite so that both adapter and BPEL work in same transaction -
    https://blogs.oracle.com/adapters/entry/creating_a_synchronous_bpel_composite_using_file_adapter
    You may control the number of threads for inbound JMS adapter using binding property "adapter.jms.receive.threads" in composite.xml
    Regards,
    Anuj

  • Dequeue from exception queue failing

    i'm having trouble dequeueing a message that has been moved to the exception queue. i can 'see' the message by looking at the queue table using Toad, but any attempt to dequeue it using DBMS_AQ.DEQUEUE results in the procedure timing out without dequeuing the message. when i try to dequeue it explicitly, using the ID, the process hangs. either way, there are no error messages.
    i'm using the default exception queue, which i have started and enabled for dequeue.
    thanks in advance for any help, simon

    after banging my head on the wall for three days, a shutdown and restart of the database solved this problem....

  • JMS and advanced Queues - how to dequeue?

    Hi,
    I've recently built a MDB that listens to an Oracle Queue (9.0.4) via JMS . Everything works fine, the only thing is that the rows that have been enqueued are not deleted (dequeued) from the queue table once the MDB has picked them up.
    This only causes a problem when the database re-starts as the MDB picks up all the messages again. And also is a problem as the table will keep growing with all the messages.
    Can you tell me what I should do to dequeue the messages? Should this be a trigger of some sort or is there something I can do from within the bean to dequeue the message once it has been consumed? Or is there another way of handling this?
    Appreciate your help.
    Cheers.

    Hello,
    Great! I need that solution :)
    Can you point out how you connected the MDB to the AQ? What software or adapter did you use?
    I have the vice versa problem.
    The MDB always deletes the message in the queue table, but a rollback never works.
    Did you enable transactions by the following settings in ejb-jar.xml:
    <container-transaction >
    <method >
    <ejb-name>MyMdb</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    I use BEA to deploy the MDB and Dips xa-compliant StartupClass package to register the AQ Connection Factory to in the JNDI tree.
    Regards
    Thomas

  • Dequeue with OCCI does not remove the message from the queue

    Hey there,
    I have this problem where no matter what dequeue option I try the messages never seem to be removed from the queue... I tried looking around and found only a similar un-answered question...
    Thanks in advance...
    void TryAnydataDequeue(oracle::occi::Connection * conn)
         try
              std::cout << "Dequeue Commence..." << std::endl;
              Consumer cons(conn);
              //Settings de dequeue
              cons.setCorrelationId("SPPC");
              cons.setQueueName("Anydata_queue");
              cons.setConsumerName("SNOOP");
              cons.setDequeueMode(cons.DEQ_REMOVE);
              //cons.setDequeueMode(cons.DEQ_LOCKED);
              std::cout << "Reception du message..." << std::endl;
              Message m2 = cons.receive(Message::ANYDATA);
              AnyData any(conn);
              any = m2.getAnyData();
              if(!any.isNull())
                   oracle::occi::TypeCode type = any.getType();
                   if(type == OCCI_TYPECODE_VARCHAR2)
                        std::string msg = any.getAsString();
                        std::cout << "Message Reçu: ";
                        std::cout << msg << std::endl;
                   else
                        std::cout << "Format du message invalide..." << std::endl;
                   std::cout << "Fin du message... (Press a key)" << std::endl;
              else
                   std::cout << "Message invalide..." << std::endl;
              System::String * theInput = System::Console::ReadLine();
         catch(SQLException ex)
              std::cout << "Exception: " << ex.getErrorCode() << " - " << ex.getMessage() << std::endl;
              System::String * tnput = System::Console::ReadLine();
    }

    The message from the queue will be removed when you do a commit after a successful dequeue call, depending upon your message retention settings.
    After you have done this processing and successfully performed a commit, what is the output of the following query:
    SQL> connect AQADMIN/password
    SQL> select msg_state from aq$<your_queue_table_name_goes_here> ;?
    If it is PROCESSED, check your queue retention settings.
    Additionally, make sure that the init.ora parameter AQ_TM_PROCESSES is set to a NON-ZERO value for this to happen.

  • Advanced Queuing for Oracle / Dequeue failed

    Hi *,
    I'm using Oracle Advanced Queuing and OC4J with some MDBs. Unfortunately sometimes I have following exception:
    03-05-21 10:29 Error listening to 'USER_QUEUE'
    oracle.jms.AQjmsException: JMS-120: Dequeue failed
         at oracle.jms.AQjmsError.throwEx(AQjmsError.java:283)
         at oracle.jms.AQjmsConsumer.dequeue(AQjmsConsumer.java:2034)
         at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:981)
         at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:918)
         at oracle.jms.AQjmsConsumer.receive(AQjmsConsumer.java:834)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:905)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:797)
         at java.lang.Thread.run(Thread.java:479)
    All messages hang in my queue with READY state. I really don't know what is happening.
    I have observed that when I run my MDB, but on the different machine, one message is consumed and the same exception arises.
    Why Oracle cannot run dequeue process correctly?
    best regards
    Maciek

    We had similar problems. Mostly the cause was incorrect message type (other than AQ$_JMS..., i. e. ancestor of "message" class) or incorrectly filled body of a message. For example, there seems to be a bug in AQ$_JMS_TEXT_MESSAGE object: you have to set at least one of varchar2 or CLOB in body of message. Otherwise, dequeue will fail, JMS assumes there is some text inside.
    We are using 8i and 9i databases and messages are created using plain constructors (not methods from 9i, since code has to run on either version). I cannot recall any troubles using methods from 9i during researching, but there might be a bug somewhere.
    Myrra

  • Dequeue from an exception queue

    Hi,
    I am very new to oracle AQ and trying dequeuing of message from an exception queue. I have created a procedure for dequeuing a message from exception queue and is working fine. I have to execute this procedure manually each time a message is moved to the exception queue. Is there any mechanism to call this procedure automatically each time the message is moved to exception queue? Please help.
    Thanks in Advance
    Lokesh

    Hello,
    as you wrote you already have a code snippet with DBMS_AQ.DEQUEUE of an exception queue.
    Wrap this DEQUEUE in an infinite loop (LOOP ... END LOOP). In order to have this procedure as an autonomous session
    you can start it as a database job:
    DECLARE
       v_jobno NUMBER(6);
    BEGIN
        DBMS_JOB.SUBMIT( v_jobno,
                        'BEGIN <your module>; END;',
                        SYSDATE, NULL );
        COMMIT;
    END;
    /Kind regards,
    WoG

  • Dequeued messages not deleted from one queue but other works

    Hi,
    I have a multiconsumer queue with two local subscribers.
    The messages go to the 'PROCESSED' state but do not get
    deleted from the queue table.
    As a test, I created another single consumer queue in a different andqueue table, but the oracle deleted the 'PROCESSED' messages as expected.
    In the multiconsumer queue, the messages are added by a trigger on the table. The enqueued messages varies from 100000 to 10000 per hour.
    aq_tm_processes = 5
    job_queue_processes=4
    What else can I do debug the problem?
    Is there any log file on the database server that I can
    look at any potential problem.
    I would appreicate any responses. This could very well
    be a newbie problem. I have not worked on advanced queues
    before and nor has anyone else in our system.
    Thanx,
    HB.

    I forgot to add that I am using default retention time
    and when I query user_queue the retention time is set to zero for the multiconsumer queue.

  • Dequeue from multi consumer queue table

    Hi,
    Even after all consumers I created have dequeued the messages (in REMOVE mode), they just didn't go from the queue table. Although my application works fine (the messages could no longer be dequeued again), I am afraid this will affect performance when messages piled up in Q table.
    I tried maunally delete the records in Q table. But the question is "is there an automatic way to handle this?"
    Thx for any feedback!

    Make sure that the init.ora parameter AQ_TM_PROCESSES is set to 1 or more. This is the parameter that controls the number of processes available to clean up the queue after the messages have been dequeued or the message has expired.

  • Dequeueing message from xmltype queue

    I have the queue build upon the XMLType (too complex to use it as a payload). When I'm trying to dequeue messages with ESB AQ Adapter they are not passing through. When building the service adapter I've specified the same schema file as destination payload type so it's rather impossible to have any differences. Is it necessary to do anything special (transformations or so) to make it working ?

    This is not a supported feature. The best solution is to write a java callout to pull the message from the queue.
    Gregory Haardt
    ALSB Prg. Manager
    [email protected]
    Edited by ghaardt at 09/11/2007 4:00 PM

  • Problems enqueuing a CLOB on JMS_TEXT queue and dequeue from JMS

    Hi, I have a PL/SQL procedure that enqueues in a JMS_TEXT queue a CLOB, and a MDB in J2EE reading messages from that queue. The problem is that text from dequeued messages appears as null in java, but if I send messages to the queue using Varchar2 I get the correct message. What's wrong?? Thanks.

    Hi,
    I encountered the same problem. The fix was to use a more recent aqapi13.jar:
    if last modification date is 22th April 2002, then it does not read CLOB content.
    if last modification date is 14th October 2004, then it does read CLOB content.
    Note I am using Oracle 9i Release 2.

  • Java advanced queue MDB class usage

    Hello,
    Loads of questions about JMS AQ and MDB.
    I have not found anything that tells you how to use the oracle.jms classes within a MDB's directly. Do I just cast the message to a AQMessage and retrieve from there?
    I have found plenty of documentation about using the oracle.jms classes. Ive found a lot of information about using advanced queues and enqueing and dequeuing to them in Java. I have found information about MDBs and how to use them as a regular service ie: using TextMessage
    Is there a simple document describing MDB oracle AQ classes? I have looked through umpteen million Oracle documents to no avail.
    Is there an interface for MDB in the Oracle AQ classes which has an onMessage() method which I can implement taking in oracle.jms classes?
    When processing a message that I would like to put on another queue do I call the AQ classes to enqueue a message and set its attributes that way or do I use the JMS classes and their methods to do that?

    http://download-west.oracle.com/docs/cd/A97688_12/generic.903/a97677/mdb.htm#1013265 should get me most of the way there.

  • Advanced Queues Snapshot too old error

    I am using the advanced queues to submit work for parallel processes running through the Oracle Job Queue.
    I have attempted running anywhere from 1 to 5 simultaneous processes (in addition the the process which submits them to the Oracle job queue and populates the advanced queues) and I am getting sporadic Snapshot too old errors when the other processes are attempting to dequeue. The Advanced queues are populated before the other processes are submitted to the job queue, so I don't see that there could be conflicts between one process enqueuing while another is dequeuing.
    The reason I am attempting this is to try and gain some performance by running processes in parallel.
    Has anyone else had problems like this? Is this a bug in Oracle 8.1.6? Is there a parameter setting I need to adjust? Are there any suggestions for getting around this problem?

    I don't know what version of the database you are running? I'm only using 8.1.7.4. But where I come from, you add datafiles to the tablespace, not the rollback segment.
    alter tablespace rollback
    add datafile '&lt;blah, blah&gt;'
    size 147m
    autoextend on next 100m maxsize 2047m;
    Make sure that you have a suitable number of rollback segments that are well-sized extents. But mostly, listen the Tom Best, and try and introduce some best practices (no pun intended) to reduce the likelihood of this situation arising.

  • Advanced Queuing Help

    Hi, I need help with creating an Advanced queue. I have already created the queue table but when I try to create the queue it says that it was sucessful, yet I can not find it. Also I need help with creating a SQL subscriber such that some sort of SQL code with enqueue a message, and the subscriber will dequeue and print it out or something. I am also going to set up a ESB process to do the some thing.
    Here is my queue_table code:
    dbms_aqadm.create_queue_table( queue_table => 'TEST_QUEUE_TABLE',
                                  queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE',
                                  multiple_consumers => True);

    Hey demorgan, I get this error with the demo. At some point I have to make a procedure with this:
    SELECT TO_NUMBER(SUBSTR(dbms_crypto.randominteger,3,1))
        INTO x
        FROM dual;I get this error: ORA-00904: : invalid identifier
    Also how do I view what is on a queue? This demo does not show that.

  • Advanced Queuing between 2 databases

    Hi,
    We want to use Oracle Advance Queuing to send a message from a source Database (transactional) to a Reporting database
    On a particular event on a record in the source database, we want to enqueue the record's code on a Queue in the target database, where the dequeuing will happen and some processing will take place for each code retrieved.
    Do we need to set up the Advanced Queuing software on both DBs?
    - Can we just have 1 queue on the target DB and get the source Database to enqueue records to it? How will the source DB will be given access to the queue?
    - Or do I really need to have a queue on each Database and use propagation?
    Thanks in advance for your help.
    Rgds

    Tony,
    thanks very much for your precious advice.
    I like your suggestion of having one queue, it keeps the infrastruture simple.
    Have I got the option of having this single queue either at the source or the target DB?
    Maybe let me summarise more precisely what I am trying to achieve: we want to copy a complex data structure on the Source DB to a simplified/flatter data structure on the reporting DB.
    An event on a row on the main table on the source DB triggers the copy.
    We are thinking of enqueing of the record's id to the queue (So app on the source DB will have to enqueue)
    and when dequeuing each message , a stored procedure will read the data structure for this record id and child tables and insert the relevant data to the report data structure on the target DB.
    So with one queue, it seems that there are 3 options, not sure which is best. The idea is to have minimum impact on the source DB
    1. Queue at the target DB. Source DB enqueues message remotely (is this possible? can't find any documentation about this?). Message is dequeued at the target and the proc (at target) reads from the source with DB link and writes the new data to the target
    2. Queue at the source DB. Source DB enqueues message locally, an application on the target DB dequeues the message and the procedure (at target) reads from the source with DB link and writes the new data to the target DB.
    3.Queue at the source DB. Source DB enqueues message locally, an application on the source DB dequeues the message and the procedure (at source) reads data from the source and writes the new data to the target using a DB link
    3. seems having the most impact on performance of the source db?
    In all case I don't think I can avoid a DB link in the sored proc (one way or the other) as the data structures are a too complex to be passed through the queue....
    What do you think?
    Thanks
    Philippe

Maybe you are looking for