Re: AQ JMS messages not "seen" at the Java side

From: <kumar.mcet_at_gmail.com>
Date: Fri, 12 Sep 2014 05:42:09 -0700 (PDT)
Message-ID: <fc3e9e4a-4b50-4b92-9e28-87df7f650ca7_at_googlegroups.com>


Try to print details from the subscriber to know if it got created successfully. Details like messageSelector,topic name etc., to make sure the connection is successful.

Also when you mean, you are not seeing any message in Java, side. When you print them, what are you seeing ? nothing or an exception when you try to print the message ? On Tuesday, September 23, 2008 7:34:24 AM UTC-7, yossarian wrote:
> I'm learning AQ (Oracle 10.2.0.3 on Linux).
>

> In my experiments, I'm enqueing messages with a PL/SQL script in
> SQL*Plus and trying to dequeue them with a little Java class.
>
> I succesfully implemented the point-to-point model, but I'm not able to
> dequeue messages with the publish-subscribe model.
>
> I get no errors, simply JMS messages are not "seen" at the Java side.
>
> Here are the statements I used to create and start the queue:
>
> ---
> exec dbms_aqadm.create_queue_table (queue_table=>'multi_message_table',
> queue_payload_type=>'SYS.XMLTYPE', multiple_consumers=>true) ;
>
> exec dbms_aqadm.create_queue (queue_name=>'multi_queue',
> queue_table=>'multi_message_table') ;
>
> exec dbms_aqadm.start_queue (queue_name=>'multi_queue') ;
>
> exec dbms_aqadm.ADD_SUBSCRIBER (QUEUE_NAME=>'multi_queue', SUBSCRIBER=>
> sys.aq$_agent ('SUBSCRIBER1','TEC_SCHEMA.MULTI_QUEUE',0)) ;
>
> exec dbms_aqadm.schedule_propagation(queue_name=>'MULTI_QUEUE', latency
> =>0);
> --
>
> Here's the PL/SQL script I'm using to enqueue messages:
>
> --
> declare
> msg SYS.XMLType;
> queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
> msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;
> msg_id RAW(16);
> aprop sys.aq$_agent;
> rlist dbms_aq.aq$_recipient_list_t ;
> Begin
>
> msg := SYS.XMLType.createXML('<?xml version="1.0"?>'<id>42</id>');
>
> aprop := sys.aq$_agent(USER, NULL, 0);
> queue_options.sequence_deviation := dbms_aq.top;
>
> rlist(1) := sys.aq$_agent ('SUBSCRIBER1','TEC_SCHEMA.MULTI_QUEUE',0) ;
> msg_props.sender_id := aprop;
> msg_props.delay := dbms_aq.no_delay;
> msg_props.recipient_list := rlist ;
>
> DBMS_AQ.ENQUEUE(
> queue_name => 'MULTI_QUEUE',
> enqueue_options => queue_options,
> message_properties => msg_props,
> payload => msg,
> msgid => msg_id
> );
>
> end ;
> /
> --
>
> And here's the Java class I'm using to dequeue messages:
>
> --
> import oracle.jdbc.*;
> import java.sql.*;
> import oracle.jms.*;
> import oracle.sql.*;
> import oracle.xdb.*;
> import javax.jms.*;
>
> public class JmsQueue {
>
> public static void main (String args[]) throws Exception
> {
> // Load the Oracle JDBC driver
> DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
>
> // create a connection factory
> java.util.Properties login = new java.util.Properties() ;
> login.put("tec_schema","tecpw") ;
> TopicConnectionFactory factory =
> AQjmsFactory.getTopicConnectionFactory
> ("jdbc:oracle:thin:_at_testserv:1521:test",login);
>
> // create an aq topic (=queue) connection, session and topic reference
> TopicConnection conn =
> factory.createTopicConnection("tec_schema","tecpw") ;
> Session sess =
> conn.createTopicSession(true,Session.CLIENT_ACKNOWLEDGE);
> Topic topic =
> ((AQjmsSession)sess).getTopic("TEC_SCHEMA","MULTI_QUEUE");
>
> // create a subscriber
> ORADataFactory orad = oracle.xdb.XMLType.getORADataFactory();
> TopicReceiver subscriber =
> ((AQjmsSession)sess).createTopicReceiver(topic,"SUBSCRIBER1",null,orad) ;
>
> // waits 60 seconds for the message
> System.out.println("wait (60
> sec)..................................") ;
> ObjectMessage msg = (ObjectMessage)subscriber.receive(60000) ;
>
> }
>
> }
> --
>
> I'm sure I'm missing something, but I'm not able to figure out what.
>
> Any suggestion?
>
> Kind regards, Y.
Received on Fri Sep 12 2014 - 14:42:09 CEST

Original text of this message