PL/SQL Callback to Dequeue

I have a procedure that automatically dequeues from a PL/SQL callback (9iR2) in a single consumer queue within the same instance. The same procedure functions when manually called agaist a propogated queue in a separate instance, but it will not work via PL/SQL callback.
Callback code:
DECLARE
reginfo1 SYS.aq$_reg_info;
reginfolist SYS.aq$_reg_info_list;
BEGIN
-- register for the pl/sql procedure notifyCB to be called on notification
-- AQNMDLINK: schema owner
-- CFR_QUEUE_DEST: prop queue
-- NMD: consumer
reginfo1 :=
SYS.aq$_reg_info ('AQNMDLINK.CFR_QUEUE_DEST:NMD',
1,
'plsql://AQNMDLINK.p_dequeue_cfr_submit',
HEXTORAW ('FF')
-- Create the registration info list
reginfolist := SYS.aq$_reg_info_list (reginfo1);
--SYS.DBMS_AQ.unREGISTER (reginfolist, 1);
SYS.DBMS_AQ.REGISTER (reginfolist, 1);
COMMIT;
END;

Perhaps this guide can help you:
Application Developer's Guide - Advanced Queuing Contents / Search / Index / PDF
http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96587.pdf
Joel P�rez

Similar Messages

  • PL/SQL Callback notification with aq$_jms_text_message

    Hi,
    i want to set up a notfication for a pl/sql callback procedure. The message in my queue is enqueued via propagation from another instance. This is my setup (using oracle 10.2.0.3):
    -------- the queue (multiconsumer): --------------
    begin
    dbms_aqadm.create_queue_table(queue_table => 'zmon_evt_in_qtable',queue_payload_type => 'sys.aq$_jms_text_message', multiple_consumers => true);
    dbms_aqadm.create_queue(queue_name => 'zmon_evt_in_queue',queue_table => 'zmon_evt_in_qtable' );
    dbms_aqadm.start_queue( queue_name =>'zmon_evt_in_queue' );
    end;
    -------- the callback-procedure (simply inserting an entry in a table called 'test'): --------------
    create or replace procedure evt_in_callback(
    context IN RAW,
    reginfo IN SYS.AQ$_REG_INFO,
    descr IN SYS.AQ$_DESCRIPTOR,
    payload IN VARCHAR2,
    payloadl IN NUMBER) is
    begin
    insert into test(textfeld) values ('RECEIVED!');
    commit;
    end evt_in_callback;
    -------- the subscriber: --------------
    begin
    dbms_aqadm.add_subscriber(queue_name => 'zmon.zmon_evt_in_queue',
    subscriber => sys.aq$_agent('zmon_evt_in_subscriber',null,null));
    end;
    -------- the notification: --------------
    declare
    reginfo sys.aq$_reg_info;
    reg_list sys.aq$_reg_info_list;
    begin
    reginfo := sys.aq$_reg_info(name => 'zmon.zmon_evt_in_queue:zmon_evt_in_subscriber',
    namespace => DBMS_AQ.NAMESPACE_AQ,
    callback => 'plsql://zmon.evt_in_callback',
    context => HEXTORAW('FF')
    reg_list := sys.aq$_reg_info_list(reginfo);
    DBMS_AQ.REGISTER(reg_list => reg_list,
    reg_count => 1);
    end;
    The callback-procedure is not fired on arrival of a message in the queue. But i can see the the appropriate notfication-entry in sys.reg$.
    Any suggestions why this doesn't work ?
    BTW: can anybody tell me the meaning of the context-Parameter in the aq$_reg_info-Type ? Everybody uses HEXTORAW('FF'), but I don't understand what that means...
    Jens
    Edited by: dschenzl on Jun 4, 2009 11:13 AM

    Finally, it's done.
    The subscriber used in the propagation has to be the notification-subscriber (zmon_evt_in_subscriber). I used another subscriber, which was not registered for notification.
    I found the solution in this thread: Callback trouble from mesage via propagated message.
    Two days filled up with frustrating work - man, how i hate that...
    Greetings to the community,
    Jens

  • PL/SQL Callback registered on multi consumer queue takes 6 seconds to call

    Registered a PL/SQL callback procedure on multi consumer Queue. if I enqueue message into queue, it takes 6 seconds to call PL/SQL callback procedure.
    Why does it takes 6 seconds ?
    I believe Queue submits DBMS Job to execute the Callback. I am not sure why it is taking 6 seconds to execute the callback.
    are there any configarable parameters to set which allows callbacks to be executed more frequently?

    You can try to change jobqueue_interval=1      
    This is a scan rate interval (seconds) of job queue parameter.
    it is 5 sec by default.
    Regards,
    Sergey

  • Pl/sql callbacks

    Has anyone ever had the plsql callback testproc work for them???
    I'm on 10.1.3.0.1.
    I run
    exec edg_utl.add_rule(rulename => 'MyRule', condition => ':event.type = 200', param => 'edg_utl.testProc',command => 'call')
    I added an insert in the testProc to insert into my testtable. That way I don't have to worry about the log level stuff.
    I never, ever, get any rows to insert into that testtable. That leads me to believe that the testProc never gets called.
    I even restart the whole machine. Nothin'.
    I've read the README in j2ee\home\applications\edge\edge\sample\StreamsSample
    I've ran:
    exec DBMS_APPLY_ADM.STOP_APPLY('EDG_APPLY');
    exec DBMS_APPLY_ADM.START_APPLY('EDG_APPLY');
    So, again, if you have successfully made this work, please do let me know some other actions I can try.
    Thanks!

    Hi,
    I'm assuming you've applied all the prereq patches.
    My guess would be that you've got Datavault enabled in the database... fire up sqlplus and see if you get:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining,
    Oracle Database Vault and Real Application Testing options
    If so, turn off datavault and run the install again. If not... don't know.
    Regards
    Gavin

  • Can't transform to JMS_TEXT_MESSAGE

    I'm trying to workaround the Interconnect AQ adapter's lack of support for JMS by creating a transformation that converts my simple ADT Payload to a JMS_TEXT_MESSAGE while propagating it from one queue to another. I keep getting:
    kwqjpropwin: Exception Occured, Error msg:
    ORA-22275: invalid LOB locator specified
    Propagation Schedule for (AQINTER.PLEDGE, NULL)encountered following error:
    ORA-22275: invalid LOB locator specified
    All of my messages are < 4000 bytes. In fact, my transformation function works fine on it's own, and I'm able to workaround the problem by registering a PL/SQL callback to dequeue the incoming message, call my transformation function and enqueue it to the destination, thus I don't think it's a permissions problem.
    Any ideas or suggestions?
    -Doug

    Perhaps this guide can help you:
    Application Developer's Guide - Advanced Queuing Contents / Search / Index / PDF
    http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96587.pdf
    Joel P�rez

  • AQ Callbacks - Blocking background processes and best practices.

    We are running several queues within our company and one of them uses pl/sql callback functionnality.
    Basically, several triggers can enqueue a message when underlying tables are updated. The goal of the callback is to "treat" those messages, which means dequeuing the messages and passing them to some procedure (determined through a confguration table and the type of message). I don't know if i'm clear enough on this but it is as important.
    In general the mechanism works perfectly but we noticed in one of our databases that, after a relatively big amount of messages enqueuing (~ 500-1000 in one trasanction), there are numerous background processes blocked on system table SYS.AQ_SRVNTFN_TABLEI. In fact, the queue starts growing and messages are not dequeued anymore by the callback, that doesn't seem to be executed anymore at all.
    We actually were also unable to re-compile the package that holds the callback procedure nor removing/adding the reference of the subscriber to the queue with DBMS_AQ. It would hang there forever...
    We are running Oracle Database 10g Enterprise Edition Release *10.2.0.4.0* and the value of AQ_TM_PROCESSES = 0.
    I don't necesseraly have a complete and clear view of how the queue mechanism works behind the scenes so forgive for some foolish things I could say :-)
    Diagnosis:
    After some research, it seems the backgrounds processes are blocked on the system table SYS.AQ_SRVNTFN_TABLE on some index for MSGID.
    If I understand correctly how the system works, the callback gets executed for a specific MSGID as we use it in the callback procedure to dequeue this message.
    I've also discovered that the default value for the WAIT dequeue option is FOREVER...
    So my idea was that, for some reason, the callback tries to dequeue a message that does not exist in the queue and... waits forever for the message to "appear".
    This at first seemed pretty unlikely to me: why would the callback be executed if no message with provided MSGID exists... then you start doubting :-)
    Attempt to resolve:
    We've decided to alter the WAIT option to not let the dequeue in the callback wait forever.
    We have made some tests (outside the callback) with NO_WAIT and also with a wait of a few seconds. Both solution prooved right so we added a wait of 60s in the callback and added some tracing.
    Since then, no more background processes seems to hang there and we are able to alter the callback procedure normally. But with the added tracing, we noticed an unexplained behavior with the execution of the callback:
    - callback runs
    - ORA-25263: no message in queue QUEUE_OWNER.MULTISRC_NOTIFQ with message ID B4FFD1115523A46EE040007F0100304F
    - callback runs again and message is dequeued and treated correctly
    The first oracle error happens fast, not after 60s as the WAIT option specifies.
    Questions:
    <li>Is the way the callback method is implemented correct (see code below) ?</li>
    <li>Do we need to commit in the callback method ? What implies committing or not ?</li>
    <li>How wouold you explain the behavior of the callback after setting the dequeue WAIT to 60s and why it does not actually wait for 60s ?</li>
    <>
    <>
    <>
    <>
    The configuration of the queue and the callback is as follow:
    - the type of the payload is SYS.ANYDATA
    - an extra index is create on CORRID column
    begin
       -- create queue table
       begin
          DBMS_AQADM.CREATE_QUEUE_TABLE(QUEUE_TABLE        => 'QUEUE_OWNER.MULTISRC_NOTIFTAB'
                                       ,QUEUE_PAYLOAD_TYPE => 'SYS.ANYDATA'
                                       ,MULTIPLE_CONSUMERS => true);
       end;
       -- create and start queue
       begin DBMS_AQADM.CREATE_QUEUE(QUEUE_NAME => 'QUEUE_OWNER.MULTISRC_NOTIFQ', QUEUE_TABLE => 'QUEUE_OWNER.MULTISRC_NOTIFTAB'); end;
       begin DBMS_AQADM.START_QUEUE(QUEUE_NAME => 'QUEUE_OWNER.MULTISRC_NOTIFQ'); end;
       -- grant access to the queue to PDO
       -- add a subscriber to the queue and register the plsql to execute
       begin
          DBMS_AQADM.ADD_SUBSCRIBER(QUEUE_NAME => 'QUEUE_OWNER.MULTISRC_NOTIFQ'
                                   ,SUBSCRIBER => SYS.AQ$_AGENT('MULTISRC_NOTIFSUBSCR', null, null));
          DBMS_AQ.REGISTER(SYS.AQ$_REG_INFO_LIST(SYS.AQ$_REG_INFO('QUEUE_OWNER.MULTISRC_NOTIFQ:MULTISRC_NOTIFSUBSCR'
                                                                 ,DBMS_AQ.NAMESPACE_AQ
                                                                 ,'plsql://PDO.PO_NOTIFY.MULTISRC_NOTIF_SUBSCRIBER?PR=0'
                                                                 ,HEXTORAW('FF')))
                          ,1);
       end;
    end;
    create index queue_owner.multisrcq_corrid on queue_owner.multisrc_notiftab (CORRID)
    The callback procedure is as follow:
    procedure MULTISRC_NOTIF_SUBSCRIBER(context  raw,
                                          REGINFO  SYS.AQ$_REG_INFO,
                                          DESCR    SYS.AQ$_DESCRIPTOR,
                                          PAYLOAD  raw,
                                          PAYLOADL number) is
        L_METHOD constant varchar2(50) := 'MULTISRC_NOTIF_SUBSCRIBER';
        R_DEQUEUE_OPTIONS    DBMS_AQ.DEQUEUE_OPTIONS_T;
        R_MESSAGE_PROPERTIES DBMS_AQ.MESSAGE_PROPERTIES_T;
        V_MESSAGE_HANDLE     raw(16);
        O_PAYLOAD            ANYDATA;
        cursor C_TREATMENTS(P_ENTITY in varchar2) is
          select T.MNOT_PROCEDURE_C
            from TA_GEN.MULTISRC_NOTIF_TREATMENTS T
           where T.MNOT_ENTITY_C = P_ENTITY
             and T.MNOT_BEGIN_D < sysdate
             and ((T.MNOT_END_D > sysdate and T.MNOT_END_D is not null) or
                 (T.MNOT_END_D is null))
           order by T.MNOT_PRIORITY_N asc;
        WK_CORRID    varchar2(128);
        WK_ENTITY    TA_GEN.MULTISRC_NOTIF_TREATMENTS.MNOT_ENTITY_C%type;
        WK_PROCEDURE TA_GEN.MULTISRC_NOTIF_TREATMENTS.MNOT_PROCEDURE_C%type;
        CT_EXEC number(2) := 0;
      begin
        -- DGH: 15.12.11 / added a wait of 60 seconds for dequeue to avoid infinite waiting (default is FOREVER)
        R_DEQUEUE_OPTIONS.WAIT := 60;
        -- dequeue message
        R_DEQUEUE_OPTIONS.MSGID         := DESCR.MSG_ID;
        R_DEQUEUE_OPTIONS.CONSUMER_NAME := DESCR.CONSUMER_NAME;
        DBMS_AQ.DEQUEUE(QUEUE_NAME         => DESCR.QUEUE_NAME,
                        DEQUEUE_OPTIONS    => R_DEQUEUE_OPTIONS,
                        MESSAGE_PROPERTIES => R_MESSAGE_PROPERTIES,
                        PAYLOAD            => O_PAYLOAD,
                        MSGID              => V_MESSAGE_HANDLE);
        -- extract entity name
        WK_CORRID := R_MESSAGE_PROPERTIES.CORRELATION;
        WK_ENTITY := SUBSTR(WK_CORRID,
                            INSTR(WK_CORRID, '##') + 2,
                            (INSTR(WK_CORRID, '##', 1, 2) -
                            INSTR(WK_CORRID, '##')) - 2);
        -- execute treatment(s)
        open C_TREATMENTS(WK_ENTITY);
        loop
          fetch C_TREATMENTS
            into WK_PROCEDURE;
          exit when C_TREATMENTS%notfound;
          execute immediate 'begin ' || WK_PROCEDURE || '(:MSG); end;'
            using O_PAYLOAD;
          CT_EXEC := CT_EXEC + 1;
        end loop;
        close C_TREATMENTS;
      exception
        when others then
          if C_TREATMENTS%isopen then close C_TREATMENTS; end if;
          PO_NOTIFY.TRACE_MULTISRC_NOTIF(L_METHOD,
                                         sqlerrm,
                                         DESCR.MSG_ID,
                                         R_MESSAGE_PROPERTIES.CORRELATION,
                                         WK_ENTITY,
                                         WK_PROCEDURE);
          rollback;
      end MULTISRC_NOTIF_SUBSCRIBER;

    Helping you with the specific issue is going to be difficult without direct access to the servers but given the importance this system seems to have to your business why are you not running on a fully supported version (10.2 has been in extended support for more than 6 months) and even in the current configuration not patched to 10.2.0.5?
    My instinct would be to focus on moving to 11.2.0.3 as quickly as possible with a corresponding change to a current operating system version if your O/S is similarly out of date.

  • Dequeue failed after reboot

    hi,
    Suppose i have three messages in a queue. They are
    message 1 with msgid F112A
    message 2 with msgid F112B
    message 3 with msgid F112C
    I used PL/SQL callback method. When the stored procedure dequeue the message 1 (other 2 messages remain in queue) with browse mode, i purposely shutdown the database server and then reboot.(Meaning, during half way processing the message, i restart the db server)
    However, found that the message 1 remain READY state in queue and no further processing on it, until it is expired.
    WHile the message 2 and 3 have been successfully dequeue after reboot.
    Why the message 1 failed to dequeue after reboot?
    Pls advise.

    It seems that the ONS port of the listener conflicts with the ONS of the OPMN apply the following:
    Explicitly disable the 10g TNS Listener from subscribing to the ONS.
    Edit the active 10g listener.ora file and add the parameter below:
    SUBSCRIBE_FOR_NODE_DOWN_EVENT_<listener_name>=OFF
    where <listener_name> would be replaced with the actual listener name
    configured in the listener.ora file. For example, if the listener name is LISTENER (default), the parameter would be:
    SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF
    then restart the listener
    This error message "127.0.0.1:6101 - listener BIND failed" should disappear.
    Hope this helps!
    BR,
    MettoMorphism

  • AQ Propagation Notifications/PLSQL Callback Query?

    I have the following scenario working but have a question:
    I have two databases, I Enqueue a message onto a Queue in Database 1 and scheduling Propagation to a Queue in Database 2.
    In Database 2 the queue has a PL/SQL procedure registered (using DBMS_AQ.Register) so that as the propagated message arrives it calls the procedure which dequeues it and saves the message to the Table.
    It is all working fine, except that the Dequeue process on Database 2 seems to get invoke after approx 5 mins after it is Enqueued. SO you can see the message on the Subscribing Queue with an Enqueue Time, and it seems to always be about 5 mins later till the procedure is kicked off to dequeue it.
    How do you set the time that it takes to dequeue the message?
    There are no parameters on the DBMS_AQ_Register proc to set this.
    I can't find anything in the docs?
    I originally had a demo setup using PL/SQL callback on a local Queue (without propagation between two Databases) and the Dequeue was virtually instantaneous?
    Regards
    Stuart

    Hello,
    jobqueue_interval is not unsupported it is just hidden. In most cases the default is enough which is why it is hidden. As I recall the default is 5 seconds in 10.2 so it does not explain the 5 minute delay you are seeing. AQ only ever uses 1/2 the available job_queue_processes so if only 1 is available I would be surprised if it worked at all. Have you increased the number to 10?
    There are no other ways to tune notification callbacks in any available version of Oracle that I am aware of.
    Thanks
    Peter

  • Callback Function in AQ not launched

    Hi All,
    I have registered a callback function on a queue. When I enqueue it has to call callback function. Below is my scrip for creation of Queue and Enqueue.
    CREATE type xxMessage_typ as object
        ( subject VARCHAR2(30), text VARCHAR2(80));
    =================================================
    BEGIN
    SYS.DBMS_AQADM.CREATE_QUEUE_TABLE(
                      QUEUE_TABLE           =>  'XXKNL_TEST_QTAB'
                     ,QUEUE_PAYLOAD_TYPE    =>  'xxMessage_typ'
                     ,MULTIPLE_CONSUMERS    =>  TRUE);
    END;
    ===============================================
    BEGIN
    SYS.DBMS_AQADM.CREATE_QUEUE(
                      QUEUE_NAME          =>   'XXKNL_TEST_Q'
                     ,QUEUE_TABLE         =>   'XXKNL_TEST_QTAB'
    END;
    ============================================
    BEGIN
    dbms_aqadm.add_subscriber
            ( queue_name => 'XXKNL_TEST_Q',
              subscriber => sys.aq$_agent( 'RECIPIENT', null, null ) );
    SYS.DBMS_AQ.REGISTER ( SYS.AQ$_REG_INFO_LIST( SYS.AQ$_REG_INFO('XXKNL_TEST_Q:RECIPIENT',DBMS_AQ.NAMESPACE_AQ,
                   'plsql://XXKNL_NOTIFYCB',
                    HEXTORAW('FF')
              1
    END;
    ===================================
    BEGIN
      SYS.DBMS_AQADM.START_QUEUE
        QUEUE_NAME => 'XXKNL_TEST_Q'
       ,ENQUEUE => TRUE
       ,DEQUEUE => TRUE
    END;
    ==========================================
    DECLARE
    enqueue_options dbms_aq.enqueue_options_t;
         message_properties dbms_aq.message_properties_t;
         message_handle RAW(16);
         message xxmessage_typ;
    BEGIN
           message := xxmessage_typ('NORMAL MESSAGE',  'This is my Q..' );
           dbms_aq.enqueue(queue_name => 'xxknl_test_q',
                          enqueue_options => enqueue_options,
                          message_properties => message_properties,
                          payload => message,
                          msgid => message_handle);
    end;
    ========================================================
    create or replace procedure xxknl_notifyCB( context raw,
                                              reginfo sys.aq$_reg_info,
                                              descr sys.aq$_descriptor,
                                              payload raw,
                                              payloadl number)
        as
         dequeue_options dbms_aq.dequeue_options_t;
         message_properties dbms_aq.message_properties_t;
         message_handle RAW(16);
        message xxmessage_typ;
       BEGIN
          dequeue_options.msgid := descr.msg_id;
          dequeue_options.consumer_name := descr.consumer_name;
          DBMS_AQ.DEQUEUE(queue_name => descr.queue_name,
                          dequeue_options => dequeue_options,
                          message_properties => message_properties,
                          payload => message,
                          msgid => message_handle);
          insert into xxknl_test values
          ( 'Dequeued and processed "' || message.text || '"' );
          COMMIT;
       END;
    Please let me know if something is missed.
    Thanks
    Rishi

    Hi,
    Kindly check below;
    AQ PL/SQL Notification: PL/SQL Callback and Email Notification (Doc ID 225749.1)
    Also let me know if there are any Q0** or J0** traces generated.
    Thanks,

  • What is the approach to handle multi messages waiting to be dequeued?

    I am testing a case where there are more than one message in the queue and how does the listener plsql works in this scenario ?
    Does this process handled in a FIFO basis or any method to process multiple messages one time?
    (Eg: Multiple MDB's handling n number more of queues)
    Or a DBMS_JOB to monitor the queue and process all in one call.?
    What is the best approach you would take?

    To understand better the order in which multiple messages can be dequeued, read the DEQUEUE procedure listed at http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_aq.htm#ARPLS401
    in particular starting in the Usage Notes with "The dequeue order is determined by the values specified at the time the queue table is created unless overridden by the msgid and correlation ID in dequeue_options."
    When you mention "how does the listener plsql work", I am assuming you mean an enqueue triggers a PL/SQL callback to a procedure you have defined. I can't find the note/article on this right now, but when the first message comes in, the PL/SQL procedure is triggered. If while it is still running, another item is queued, Oracle will see that the PL/SQL procedure is still running and not trigger the procedure again. The callback procedure will need to dequeue all messages while it is running in order to pick up any new messages that may have been enqueued after it was started by Oracle but before it ended.
    DBMS_JOB does not monitor the queue. Several internal Oracle procedures do. EMON (Event Montior) and QMON (Queue Monitor) do most of the heavy work.
    Hope that helps.

  • Plsql callback (dbms_aq.register) stops working

    we had, for quite a while, a working situation where a incoming message notifies a plsql procedure, which dequeues and handles the message, resulting in a response message in a different queue
    the queue has one subscriber and through dbms_aq.register I registered a plsql callback and all worked fine for about a year
    suddenly this stopped working - messages aren't dequeued anymore - for no apparent reason (nothing changed in this part of the database)
    I already dropped and recreated the queue table, queues, subscriptions and registered the plsql callback again, but no results
    does anyone have a clue where to look (specific sys tables/views, database parameters etc) because I am running out of ideas...
    we are running the 10.2.0.1.0 database
    greatings
    Jan

    Jan,
    The EMNO (Event Monitor) process is responsible to execute the AQ notifications, in this case your pl/sql callback. This may or may not be your problem. I'm not sure how much help this link will be but it covers Event Monitor issues for various versions of Oracle. https://metalink.oracle.com/metalink/plsql/f?p=130:14:2721106654994549115::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,105067.1,1,1,1,helvetica
    Jason

  • Dequeuing the message using Non Sys user

    Hi all,
    I've implemented Advanced Queuing in one Schema(Say "temp") which has AQ privileges. My requirement is Asynchronous Communication between two programs.
    In One program i've DBMS_AQ.ENQUEUE to put the message onto the queue. The user "temp" enqueued the message.
    I've a anonymous PL/SQL callback procedure registered to dequeue the message. but while dequeuing the message, the user is "SYS". Immediately after dequeuing the message, i've a call to the second program which uses some views. In my application we have dba policies applied to these views. So only temp user can access those views where SYS user doesnt have any access to these views.
    we already have one solution i.e., giving access to SYS user also but this will result in some other security concerns for the application
    Another solution could be dequeuing the message with "temp" user (NON sys user).
    So i would like to know whether it is possible to dequeue the message with NON-SYS user ? i've tried searching the dequeue options and message properties but couldn't get anything..
    can anyone help me in solving this problem??

    Hi paul,
    Thanks for the response :). I've tried this already but still the dequeue user id "SYS". i'll explain you in detail with the code.
    I've create queue table and queue with the following code :
    create or replace TYPE temp_msg_type as object (seq_no NUMBER(10),
    req_type varchar2(6))
    begin
    dbms_aqadm.create_queue_table(
    queue_table => 'test_queue_tab',
    queue_payload_type => 'temp_msg_type',
    multiple_consumers => true);
    dbms_aqadm.create_queue(
    queue_name => 'test_queue',
    queue_table => 'test_queue_tab');
    dbms_aqadm.start_queue(
    queue_name => 'test_queue');
    end;
    After this an Agent is subscribed to this queue.
    begin
    dbms_aqadm.add_subscriber(
    queue_name => 'test_queue',
    subscriber => sys.aq$_agent('recipient', null, null));
    end;
    Then registered an PL/SQL callback procedure to this queue.
    begin
    dbms_aq.register(aq$_reg_info_list(
    aq$_reg_info('test_queue:RECIPIENT',
    DBMS_aq.NAMESPACE_AQ,
    'plsql://notifyCB_prd',
    HEXTORAW('FF')) ) ,
    1);
    end;
    The follwing procedure will enqueue the message. in the below code before i enqueue it i am inserting the current sessions' user, it got printed as "SCOTT".
    create or replace procedure enqueue_msg_prd( O_status_code IN OUT varchar2 )
    as
    enqueue_options dbms_aq.enqueue_options_t;
    message_properties dbms_aq.message_properties_t;
    message_handle RAW(16);
    message temp_msg_type;
    begin
    --enqueue_options.visibility := DBMS_AQ.IMMEDIATE;
    message := temp_msg_type(112, user);
    O_status_code := 'S';
    dbms_aq.enqueue(queue_name => 'test_queue',
    enqueue_options => enqueue_options,
    message_properties => message_properties,
    payload => message,
    msgid => message_handle);
    end;
    The following procedure will dequeue the message. this procedure will be automatically triggered when i commit the enqueue transaction since there is anonymous callback procedure registered for this queue. In the below code after i dequeue it i am inserting the sessions' user, it got printed as "SYS".
    create or replace
    procedure notifyCB_prd( context raw,
    reginfo aq$_reg_info,
    descr aq$_descriptor,
    payload raw,
    payloadl number)
    as
    dequeue_options dbms_aq.dequeue_options_t;
    message_properties dbms_aq.message_properties_t;
    message_handle raw(16);
    message temp_msg_type;
    begin
    dequeue_options.msgid := descr.msg_id;
    dequeue_options.consumer_name := descr.consumer_name;
    --execute immediate 'conn  session set current_user= scott';
    DBMS_AQ.DEQUEUE(
    queue_name => descr.queue_name,
    dequeue_options => dequeue_options,
    message_properties => message_properties,
    payload => message,
    msgid => message_handle);
    insert into temp values(message.seq_no,user);
    commit;
    end;
    Even i queried the aq$test_queue_Tab view. in this view, value in deq_user_id is "SYSS"
    is there any way to get the users session as 'SCOTT' ??

  • Trace for a Oracle Callbacks

    Does anyone know how to TRACE the 'sessions' that are performing the callbacks? I need to report the performance statistics and usages involved with using the PL/SQL callback.
    I have tried putting the instance into trace mode (alter system set sql_trace=true) and restarting the instance but I can not find any evidence of my callback procedure being called in the resulting trace files.
    Thanks
    Russell

    Thanks for the responses.
    'Callback' is a term used by Oracle, within the context of AQ, for notification of automatic notification of new messages. For your education, it can either execute a PL/SQL procedure, generate an email or make a HTTP request.
    I am attempting to trace on a v10.2 database, but the process for trace is typically the same across versions (excepting some old versions).
    re Dan: thos sort of reply is not at all helpful, could I suggest if you do not know the subject matter then do not reply. In that way volunteers can save a lot of valuable time
    According to Metalink (Note:305662.1) these processes can be traced by the following method :
    QUOTE>>
    1. For CPU consumption issues sql trace the QMON process in question by doing the following
    Determine the pid of the qmn process (by viewing the OS processes), call it X
    sqlplus "/ as sysdba"
    oradebug setospid X
    oradebug unlimit
    oradebug Event 10046 trace name context forever, level 12
    --Generate trace for 20 minutes
    oradebug Event 10046 trace name context off
    << QUOTE.
    Russell

  • Enqueue AQ$_JMS_OBJECT_MESSAGE via PLSQL to JMS and Dequeue via Bean

    Hi,
    I want to be able to enqueue on to AQ$_JMS_OBJECT_MESSAGE queue and the dequeue to via Java Bean.
    Unfortunately I am having problems dequeuing via the messege driven bean as it is not able to dequeue any of the messages enqueued via oracle SQL plus
    I am able to enqueue and dequeue via the bean. I am also able to enqueue and dequeue via oracle SQL plus and able to dequeue and messages enqueued via the Java bean . Hoever I am not able to enqueue via Oracle SQL plus and dequeue via Java bean
    I am thinking that I have not set sumthing properly but I have checked everything I know
    P.S. - I am still learning all about AQ, so if I have missed an obvious solution, please let me know.
    my code is quite simple - see below
    l_enqueue_options dbms_aq.enqueue_options_t;
    l_message_properties dbms_aq.message_properties_t;
    l_msg_id xxaq.xxaq_imran_qt.msgid%type;
    -- specifics for JMS Queues
    l_queue_name varchar2(30) := 'XXAQ.XXAQ_IMRAN_Q';
    l_payload SYS.AQ$_JMS_OBJECT_MESSAGE;
    l_header SYS.AQ$_JMS_HEADER;
    l_properties sys.AQ$_JMS_USERPROPARRAY;
    l_replyto sys.aq$_agent;
    l_data_items xxserror.xxsys_event_logs.data_items%type;
    l_messages xxserror.xxsys_event_logs.message%type;
    e_error exception;
    l_bytes_len number(38);
    l_bytes_raw raw(2000);
    begin
    l_properties := SYS.AQ$_JMS_USERPROPARRAY(
    SYS.AQ$_JMS_USERPROPERTY('JMS_OracleDeliveryMode'
    ,100
    ,'2'
    ,null
    ,27));
    l_properties.extend;
    l_properties(2) := SYS.AQ$_JMS_USERPROPERTY('APPLICATION_ID' -- name
    ,200 -- type
    ,null -- str_value
    ,p_app_id -- num_value
    ,24); -- java_type
    l_properties.extend;
    l_properties(3) := SYS.AQ$_JMS_USERPROPERTY('TRIGGER'
    ,100
    ,p_event_type
    ,null
    ,27);
    -- The replyto element seems to contain the following values
    l_replyto := sys.aq$_agent(' ', null, 0);
    l_header := sys.aq$_jms_header
    (l_replyto
    ,null
    ,'XXAQ' -- User
    ,null
    ,null
    ,null
    ,l_properties);
    -- Now build up the message.
    -- l_header.properties := l_properties;
    l_bytes_raw := utl_raw.cast_to_raw(p_app_id);
    l_bytes_len := length(l_bytes_raw);
    l_payload := sys.aq$_jms_object_message
    (l_header
    ,l_bytes_len
    ,l_bytes_raw
    ,null);
    dbms_aq.enqueue(queue_name => l_queue_name
    ,enqueue_options => l_enqueue_options
    ,message_properties => l_message_properties
    ,payload => l_payload -- payload + header
    ,msgid => l_msg_id);

    Hi, have you got the solution of the problem? I am encountering the same issue here too. Thank you!

  • AQ PL/SQL registered notifications

    Suppose I want to see what registered notifications exist for AQ plsql notifications.
    What I'm talking about are those notifications to PL/SQL callback procedures that have been registered using DBMS_AQ.REGISTER.
    I've searched and searched for data dictionary information about this but cannot find it.
    How can I use DBMS_AQ.UNREGISTER if I do not know what is already registered ?
    I would have thought that SYS.ALL_STREAMS_MESSAGE_CONSUMERS would have been a good guess but it doesn't have any rows and I have a working PLSQL notification active.
    Database is v10.2.
    Anyone know where to find this information ?
    Thanks.

    Hello,
    Unfortunately there is not a user view which is definitely an oversight. As suggested you could be granted the necessary privilges on sys.reg$ to overcome this.
    However, this whole area has been re-invigorated by the Database Change Notification feature which came in in 10.2. So much so that in 11.1 onwards you have the SUBSCRREGISTRATIONS and other v$ views as per http://download.oracle.com/docs/cd/B28359_01/server.111/b28420/aq_views.htm#sthref1151.
    The EMON process architecture has been changed to the now standard Coordinator/slave architecture as well. So with this investment in development in this area the robustness, scalability and diagnosability is improving.
    Thanks
    Peter

Maybe you are looking for