Weblogic: Interoperating with Oracle AQ JMS. A tip for sending messagesPosted: 02/08/2013
I usually work with Oracle Streams Advanced Queuing (AQ) integrated with Weblogic. In PL/SQL programs you can set the exception queue where you want to move the messages that couldn’t be delivered to their destinations, when you send a message, for example:
declare enq_msgid raw(16) ; eopt dbms_aq.enqueue_options_t; mprop dbms_aq.message_properties_t; message sys.aq$_jms_text_message; begin mprop.priority := 1; mprop.exception_queue := 'test_exception_q'; message := sys.aq$_jms_text_message.construct() ; message.set_text('This is a Test') ; dbms_aq.enqueue(queue_name => 'test_q', enqueue_options => eopt, message_properties => mprop, payload => message, msgid => enq_msgid) ; commit; end;
But, how to set the exception queue when you’re programming in Java, in the context of an integration between Oracle AQ and Weblogic? The solution I’ve found is to set the string property called JMS_OracleExcpQ to the message with the name of the Oracle AQ exception queue, for example:
... javax.jms.TextMessage msg = jmsSession.createTextMessage(); msg.setStringProperty("JMS_OracleExcpQ", "TEST.TEST_EXCEPTION_Q"); msg.setText("This is a Test"); jmsProducer.send(msg); ...
An important advice: put the name in uppercase and preceded by the name of the schema.
Finally, I’d like to point out that this is a good solution in the context of an integration between Oracle AQ and Weblogic, but makes the code non portable, if you want to change the messaging provider of your Weblogic Application Server.
- Oracle Streams Advanced Queuing (AQ) integrated with Weblogic
- Oracle Streams Advanced Queuing User’s Guide