I have an Oracle AQ with the queue type of SYS.AQ$_JMS_TEXT_MESSAGE. What I'm trying to do is to insert a text into the mentioned queue from a java application.
The equivalent SQL query is
declare
r_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
v_message_handle RAW(16);
o_payload SYS.AQ$_JMS_TEXT_MESSAGE;
begin
o_payload := sys.aq$_jms_text_message.construct;
o_payload.set_text(xmltype('<user>text</user>').getClobVal());
sys.dbms_aq.enqueue (
queue_name => 'QUEUE_NAME',
enqueue_options => r_enqueue_options,
message_properties => r_message_properties,
payload => o_payload,
msgid => v_message_handle
);
commit;
end;
/
I got most of it right using this guide, but I'm stuck at
o_payload := sys.aq$_jms_text_message.construct;
o_payload.set_text(xmltype('<user>text</user>').getClobVal());
The guide shows how to enqueue a RAW message, but I need it to be JMS, otherwise the data type doesn't match the queue type.
Any help would be appreciated, because even with the almighty google I am not able to find a solution to this problem. Is there a way to do it using the oracle.jdbc.aq
classes, or do I just have to suck it up and use the SQL query?
Just copy paste this code and try. (if it works for you) Then carefully go through the code, and understand.
While executing,
after that,
Then comment/uncomment each line respectively and give a try.
}
You will need to copy these jars/libs to your java project from your oracle DB setup directory
The credits should go to Ratha for this article[1]. There were few stuff to be amended, I just modified those and provided the code.
[1] http://wso2.com/library/tutorials/2011/11/configuring-wso2-esb-with-oracle-as-messaging-media/
Thanks