Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JMS/AQ: Setting properties for JMS message using PL/SQL

198189Apr 25 2002
I have created a procedure in PL/SQL that uses JMS messages, and now I need to include a property so that the subscriber can use a message selector to filter out unwanted messages. Is this possible using PL/SQL?

A previous post said: "... But you can have properties in the message payload itself and also define selectors on the message content ...". But I looked at Sun's tutorial and there it said: "A message selector cannot select messages on the basis of the content of the message body."

I have 300 different screens and messages apply only to one screen at a time. When the user is looking at screen 'A' I want him to only recieve messages that apply to screen 'A'. I thought I would do this with message selector, but is there any other way?

Here is my code(borrowed from an earlier post)

PROCEDURE ENQUEUE_JMS_MESSAGE AS
BEGIN
DECLARE
Enqueue_options DBMS_AQ.enqueue_options_t;
Message_properties DBMS_AQ.message_properties_t;
Message_handle RAW(16);
User_prop_array SYS.AQ$_JMS_USERPROPARRAY;
Agent SYS.AQ$_AGENT;
Header SYS.AQ$_JMS_HEADER;
Message SYS.AQ$_JMS_TEXT_MESSAGE;
Message_text VARCHAR2(100);
BEGIN

Agent := SYS.AQ$_AGENT('',NULL,0);
User_prop_array := SYS.AQ$_JMS_USERPROPARRAY();
Header := SYS.AQ$_JMS_HEADER( Agent, '', 'aq1', '', '', '', User_prop_array);
Message_text := 'Message 1 from PL/SQL';
Message := SYS.AQ$_JMS_TEXT_MESSAGE(Header, LENGTH(Message_text), Message_text, NULL);


DBMS_AQ.ENQUEUE(queue_name => 'tstopic',
Enqueue_options => enqueue_options,
Message_properties => message_properties,
Payload => message,
Msgid => message_handle);

END;
END;


-Christer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 5 2002
Added on Apr 25 2002
4 comments
723 views