Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

View: New views
7 Messages — Rating Filter:   Alert me  

Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

by RickLaird :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using using the 2.1.2 and I am having trouble setting the the payloadFactory for the JMS endpoint.

I have started by using the Oracle Advanced Queue Cookbook example at
http://mulesource.org/display/MULE2CB/Connecting+to+Oracle+AQ 

I tried to add a property to the  <jms:inbound-endpoint/> without success as shown below.

<model name="MyAqModel">
        <service name="AQPoller">
            <inbound>
                <jms:inbound-endpoint name="ProcessRoutingComplete" connector-ref="OracleAQConnector"
                    queue="SFMFG.MASTERROUTING_Q" >
                   <!-- Added property here for payloadFactory -->
                   <property key="payloadFactory" value="oracle.xdb.XMLTypeFactory"/>
                </jms:inbound-endpoint>  
            </inbound>
            <outbound>
                <pass-through-router>
                    <vm:outbound-endpoint name="VM-Q_MDX_MDS" address="vm://oaq.outbound" />  
                </pass-through-router>
            </outbound>
        </service>
    </model>

I get an exception
oracle.jms.AQjmsException: JMS-137: Payload factory must be specified for destinations with ADT payloads

Any help would be greatly appreciated.

Rick Laird


RE: Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

by antoine.borg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rick,

Can you encode this property onto the endpoint?

jms://SFMFG.MASTERROUTING_Q?payloadFactory=oracle.xdb.XMLTypeFactory

HTH

A


Antoine Borg, Senior Consultant | Tel: +32 28 504 696
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
email: antoine.borg@... | blog: blog.ricston.com | web: ricston.com

-----Original Message-----
From: RickLaird [mailto:ricklaird@...]
Sent: Monday, January 19, 2009 4:32 AM
To: user@...
Subject: [mule-user] Setting payloadFactory for Oracle AQ JMS endpoint in
the Cookbook example


I am using using the 2.1.2 and I am having trouble setting the the
payloadFactory for the JMS endpoint.

I have started by using the Oracle Advanced Queue Cookbook example at
http://mulesource.org/display/MULE2CB/Connecting+to+Oracle+AQ 

I tried to add a property to the  <jms:inbound-endpoint/> without success as
shown below.

<model name="MyAqModel">
        <service name="AQPoller">
            <inbound>
                <jms:inbound-endpoint name="ProcessRoutingComplete"
connector-ref="OracleAQConnector"
                    queue="SFMFG.MASTERROUTING_Q" >
                   <!-- Added property here for payloadFactory -->
                   <property key="payloadFactory"
value="oracle.xdb.XMLTypeFactory"/>
                </jms:inbound-endpoint>  
            </inbound>
            <outbound>
                <pass-through-router>
                    <vm:outbound-endpoint name="VM-Q_MDX_MDS"
address="vm://oaq.outbound" />  
                </pass-through-router>
            </outbound>
        </service>
    </model>

I get an exception
oracle.jms.AQjmsException: JMS-137: Payload factory must be specified for
destinations with ADT payloads

Any help would be greatly appreciated.

Rick Laird


--
View this message in context:
http://www.nabble.com/Setting-payloadFactory-for-Oracle-AQ-JMS-endpoint-in-t
he-Cookbook-example-tp21536427p21536427.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It is also possible you are sending the wrong type of message to the queue . . .

Was your queue table created in Oracle  . .something like this?

BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table        => 'TableName',
queue_payload_type => 'sys.aq$_jms_text_message');
END;

If not, that could be your problem.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

by Lalitha_Kagithapu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have the same problem when trying to read a message from a queue.My message type is XML and using

create or replace PROCEDURE setup_testqueue IS
  BEGIN
    dbms_aqadm.create_queue_table(queue_table => 'xml_test_qtab',   queue_payload_type => 'sys.XMLTYPE');

    dbms_aqadm.create_queue(queue_name => 'xml_test_queue',   queue_table => 'xml_test_qtab');

    dbms_aqadm.start_queue(queue_name => 'xml_test_queue');
   
DECLARE
    queue_options       DBMS_AQ.ENQUEUE_OPTIONS_T;
    message_properties  DBMS_AQ.MESSAGE_PROPERTIES_T;
    message_id          RAW(16);
    message          SYS.XMLType;
BEGIN
    message := sys.XMLType.createXML('<?xml
version="1.0"?><test>MULE</test>');

    DBMS_AQ.ENQUEUE(        queue_name => 'xml_test_queue',
                                         enqueue_options =>
queue_options,
                                       message_properties =>
message_properties,
                                       payload => message,
                                     msgid => message_id);
    COMMIT;

END;

  END;

Any suggestions will be of great help and is really urgent.

Regards,
Lalitha
--------------------------------------------------
stefano.falconetti-2 wrote:
It is also possible you are sending the wrong type of message to the queue . . .

Was your queue table created in Oracle  . .something like this?

BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table        => 'TableName',
queue_payload_type => 'sys.aq$_jms_text_message');
END;

If not, that could be your problem.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

by RickLaird :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What I did was to stop using the XMLtype in as the payload and just use the JMS TeTXMessage. Then create the XMLType of the way out or convert it on the way into the Queue.

I just use the JMS Message package capability.

CREATE OR REPLACE
procedure CreateQueue(vi_queue_name varchar2) is

  multiple_consumers boolean := false
 
  enqueue       boolean := sys.diutil.int_to_bool(1);
  dequeue       boolean := sys.diutil.int_to_bool(1);
  v_queue_table varchar2(100) := upper(vi_queue_name) || '_QTAB';
  v_queue       varchar2(100) := upper(vi_queue_name) || '_Q';
begin
  -- create the table
  sys.dbms_aqadm.create_queue_table(queue_table        => v_queue_table,
                                    queue_payload_type => 'sys.aq$_jms_text_message',
                                    storage_clause     => 'tablespace USER_DATA',
                                    multiple_consumers => multiple_consumers);
  -- create the queue
  sys.dbms_aqadm.create_queue(queue_name     => v_queue,
                              queue_table    => v_queue_table,
                              retention_time => 600);

  -- grant privilege to
  DBMS_AQADM.GRANT_QUEUE_PRIVILEGE(privilege    => 'ALL',
                                   queue_name   => v_queue,
                                   grantee      => 'MT_CONPOOL_USER',
                                   grant_option => FALSE);

  -- start the queue
  sys.dbms_aqadm.start_queue(queue_name => v_queue,
                             enqueue    => enqueue,
                             dequeue    => dequeue);
end;

to enqueue
create or replace enqueue as
  c1            clob;
  queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
  msg_props     DBMS_AQ.MESSAGE_PROPERTIES_T;
  msg_id        RAW(16);
  selectSql     varchar2(4000);
  msg           SYS.AQ$_JMS_TEXT_MESSAGE;
Begin
   msg := Sys.Aq$_Jms_Text_Message.Construct;
   msg.set_text(c1);
--  msg := sys.xmltype.createXml(c1);
  sys.DBMS_AQ.ENQUEUE(queue_name         => 'MASTERROUTING_Q',
                      enqueue_options    => queue_options,
                      message_properties => msg_props,
                      payload            => msg,
                      msgid              => msg_id);
End;

I hope this helps.

Rick Laird

Hi,

I have the same problem when trying to read a message from a queue.My message type is XML and using

create or replace PROCEDURE setup_testqueue IS
  BEGIN
    dbms_aqadm.create_queue_table(queue_table => 'xml_test_qtab',   queue_payload_type => 'sys.XMLTYPE');

    dbms_aqadm.create_queue(queue_name => 'xml_test_queue',   queue_table => 'xml_test_qtab');

    dbms_aqadm.start_queue(queue_name => 'xml_test_queue');
   
DECLARE
    queue_options       DBMS_AQ.ENQUEUE_OPTIONS_T;
    message_properties  DBMS_AQ.MESSAGE_PROPERTIES_T;
    message_id          RAW(16);
    message          SYS.XMLType;
BEGIN
    message := sys.XMLType.createXML('<?xml
version="1.0"?><test>MULE</test>');

    DBMS_AQ.ENQUEUE(        queue_name => 'xml_test_queue',
                                         enqueue_options =>
queue_options,
                                       message_properties =>
message_properties,
                                       payload => message,
                                     msgid => message_id);
    COMMIT;

END;

  END;

Any suggestions will be of great help and is really urgent.

Regards,
Lalitha
--------------------------------------------------
stefano.falconetti-2 wrote:
It is also possible you are sending the wrong type of message to the queue . . .

Was your queue table created in Oracle  . .something like this?

BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table        => 'TableName',
queue_payload_type => 'sys.aq$_jms_text_message');
END;

If not, that could be your problem.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

by Lalitha_Kagithapu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Rick.Just gave the Payload type as - 'sys.aq$_jms_text_message' while creating the queue.

-Lalitha.


What I did was to stop using the XMLtype in as the payload and just use the JMS TeTXMessage. Then create the XMLType of the way out or convert it on the way into the Queue.

I just use the JMS Message package capability.

CREATE OR REPLACE
procedure CreateQueue(vi_queue_name varchar2) is

  multiple_consumers boolean := false
 
  enqueue       boolean := sys.diutil.int_to_bool(1);
  dequeue       boolean := sys.diutil.int_to_bool(1);
  v_queue_table varchar2(100) := upper(vi_queue_name) || '_QTAB';
  v_queue       varchar2(100) := upper(vi_queue_name) || '_Q';
begin
  -- create the table
  sys.dbms_aqadm.create_queue_table(queue_table        => v_queue_table,
                                    queue_payload_type => 'sys.aq$_jms_text_message',
                                    storage_clause     => 'tablespace USER_DATA',
                                    multiple_consumers => multiple_consumers);
  -- create the queue
  sys.dbms_aqadm.create_queue(queue_name     => v_queue,
                              queue_table    => v_queue_table,
                              retention_time => 600);

  -- grant privilege to
  DBMS_AQADM.GRANT_QUEUE_PRIVILEGE(privilege    => 'ALL',
                                   queue_name   => v_queue,
                                   grantee      => 'MT_CONPOOL_USER',
                                   grant_option => FALSE);

  -- start the queue
  sys.dbms_aqadm.start_queue(queue_name => v_queue,
                             enqueue    => enqueue,
                             dequeue    => dequeue);
end;

to enqueue
create or replace enqueue as
  c1            clob;
  queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
  msg_props     DBMS_AQ.MESSAGE_PROPERTIES_T;
  msg_id        RAW(16);
  selectSql     varchar2(4000);
  msg           SYS.AQ$_JMS_TEXT_MESSAGE;
Begin
   msg := Sys.Aq$_Jms_Text_Message.Construct;
   msg.set_text(c1);
--  msg := sys.xmltype.createXml(c1);
  sys.DBMS_AQ.ENQUEUE(queue_name         => 'MASTERROUTING_Q',
                      enqueue_options    => queue_options,
                      message_properties => msg_props,
                      payload            => msg,
                      msgid              => msg_id);
End;

I hope this helps.

Rick Laird
Lalitha_Kagithapu wrote:
Hi,

I have the same problem when trying to read a message from a queue.My message type is XML and using

create or replace PROCEDURE setup_testqueue IS
  BEGIN
    dbms_aqadm.create_queue_table(queue_table => 'xml_test_qtab',   queue_payload_type => 'sys.XMLTYPE');

    dbms_aqadm.create_queue(queue_name => 'xml_test_queue',   queue_table => 'xml_test_qtab');

    dbms_aqadm.start_queue(queue_name => 'xml_test_queue');
   
DECLARE
    queue_options       DBMS_AQ.ENQUEUE_OPTIONS_T;
    message_properties  DBMS_AQ.MESSAGE_PROPERTIES_T;
    message_id          RAW(16);
    message          SYS.XMLType;
BEGIN
    message := sys.XMLType.createXML('<?xml
version="1.0"?><test>MULE</test>');

    DBMS_AQ.ENQUEUE(        queue_name => 'xml_test_queue',
                                         enqueue_options =>
queue_options,
                                       message_properties =>
message_properties,
                                       payload => message,
                                     msgid => message_id);
    COMMIT;

END;

  END;

Any suggestions will be of great help and is really urgent.

Regards,
Lalitha
--------------------------------------------------
stefano.falconetti-2 wrote:
It is also possible you are sending the wrong type of message to the queue . . .

Was your queue table created in Oracle  . .something like this?

BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table        => 'TableName',
queue_payload_type => 'sys.aq$_jms_text_message');
END;

If not, that could be your problem.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: Setting payloadFactory for Oracle AQ JMS endpoint in the Cookbook example

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just went through hell on this and depending on how much trouble we have in the Mule implementation, I may revert to TextMessage.
But here is the solution to save yourself the trouble:

Unmarshalling Oracle types from Message interface requires more plumbing and references to additional Oracle libraries.
Install jPublisher on your workstation from the Oracle client install and create a wrapper class for SYS.XMLTYPE (e.g class OraXML implements ORAData, ORADataFactory):

SET CLASSPATH=C:\Oracle\product\10.2.0\db_1\sqlj\lib\translator.jar;C:\Oracle\product\10.2.0\db_1\sqlj\lib\runtime12.jar;C:\Oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar;C:\Oracle\product\10.2.0\db_1\LIB\xmlparserv2.jar
jpub -user=user/password@SID -sql=SYS.XMLTYPE:OraXML -usertypes=oracle -methods=false -compile=false

Edit the class file: OraXML.java to add the correct package and remove the import oracle.jpub.runtime so jpub jar not needed in mule.

Then unmarshall in the message handler:

public void onMessage(Message msg) {
      try {
         oracle.jms.AQjmsAdtMessage omsg = (oracle.jms.AQjmsAdtMessage) msg;
         OraXML xml = (OraXML) omsg.getAdtPayload();
         oracle.sql.OPAQUE data = new OPAQUE(xml.getDescriptor(), xml.toBytes(), xml.getJavaSqlConnection());
         oracle.xdb.XMLType poxml = oracle.xdb.XMLType.createXML(data);
         System.out.println("********* MESSAGE *******");
         System.out.println("JMSMessageID:  " + omsg.getJMSMessageID());
         System.out.println(poxml.getStringVal());

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email