Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Advanced Queuing. Can not read message in publish / subscrtibe mode.

Re: Advanced Queuing. Can not read message in publish / subscrtibe mode.

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Thu, 07 Oct 2004 21:20:52 -0700
Message-ID: <1097209335.67847@yasure>


Alexander Zemerov wrote:

> Hi Everyone,
>
> I have a problem with implementation of publish/subscribe scenario.
> The next steps are done -
> 0) Oracle 8.1.7.4.0
> 1) create a type for messaging
> 2) create simple (subscribing) queue and start it
> 3) create multiple (publishing) queue and start it
> 4) add a subscriber (simple queue, step #2) to the multiple queue
> (step #3)
> 5) send a message to the multiple queue; have no exceptons - message
> has a recepient.
> 6) try to read from the simple queue - have an timeout exception - no
> messages available for dequeuing.
>
> Additional info -
> 1) in the table AQ$_MSG_MULTIPLE_H I can see my message Id with
> subscriber#=0
> 2) in the table AQ$_MSG_MULTIPLE_S subscriber with #0 has
> queue_name='0' and no name
> 3) table MSG has no records at all
> 4) table MSG_MULTIPLE has a record with my message
>
>
> What is the problem? Do I need to do some additional work?
> Sorry if my question is too simple or stupid - I just couldn't find
> the answer in Oracle examples...
>
> Thank you,
> Alexander.
>
> createtype message_type as object (subject varchar2(30),text
> varchar2(80));
>
> begin
> -- create simple queue
> dbms_aqadm.create_queue_table(
> queue_table=>'aeme.msg',
> sort_list=>'PRIORITY,ENQ_TIME',
> queue_payload_type=>'aeme.message_type');
> dbms_aqadm.create_queue(
> queue_name=>'msg_queue',
> queue_table=>'aeme.msg');
> dbms_aqadm.start_queue(
> queue_name=>'msg_queue');
>
> -- create multiple queue
> dbms_aqadm.create_queue_table(
> queue_table=>'aeme.msg_multiple',
> multiple_consumers=>TRUE,
> queue_payload_type=>'aeme.message_type',
> compatible=>'8.1');
> dbms_aqadm.create_queue(
> queue_name=>'msg_queue_multiple',
> queue_table=>'aeme.msg_multiple');
> dbms_aqadm.start_queue(
> queue_name=>'msg_queue_multiple');
> end;
>
>
> -- add a subscriber
> declare
> subscriber sys.aq$_agent;
> begin
> subscriber := sys.aq$_agent('Test1','msg_queue',null);
> dbms_aqadm.add_subscriber(
> queue_name => 'msg_queue_multiple',
> subscriber => subscriber,
> rule => 'priority = 1');
> end;
>
> -- send a message to a multiple queue (publish)
> declare
> eo dbms_aq.enqueue_options_t;
> mp dbms_aq.message_properties_t;
> msgid raw(16);
> msg message_type;
> begin
> eo.visibility := dbms_aq.IMMEDIATE;
> eo.relative_msgid := null;
> eo.sequence_deviation := null;
> msg := message_type('TEST', 'HELLO 1');
> dbms_aq.enqueue('msg_queue_multiple',eo,mp,msg,msgid);
> dbms_output.put_line('msgid='||msgid);
> end;
>
> -- read a message from a simple queue
> declare
> dequeueopts DBMS_AQ.DEQUEUE_OPTIONS_T;
> msgprops DBMS_AQ.MESSAGE_PROPERTIES_T;
> msgid raw(16);
> msg message_type;
> begin
> dequeueopts.wait := 1;
> dbms_aq.dequeue( 'msg_queue', dequeueopts, msgprops, msg, msgid );
> dbms_output.put_line('msgid='||msgid||', subj='||msg.subject||',
> text='||msg.text);
> END;
Try the AQ demos at http://www.psoug.org Click on Morgan's Library
Click on DBMS_AQADM and DBMS_AQ

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Thu Oct 07 2004 - 23:20:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US