09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Enqueuing a Message [Add Payload]<br />

Message := aq.message_typ(’NORMAL MESSAGE’,<br />

’enqueued to msg_queue first.’);<br />

DBMS_AQ.ENQUEUE(queue_name => ’msg_queue’,<br />

Enqueue_options => enqueue_options,<br />

Message_properties => message_properties,<br />

transformation => ’AQ.MSG_MAP’,<br />

Payload => message,<br />

Msgid => message_handle);<br />

COMMIT;<br />

END;<br />

Where MSG_MAP was created as follows:<br />

BEGIN<br />

DBMS.TRANSFORM.CREATE_TRANSFORMATION<br />

(<br />

schema => ’AQ’,<br />

name => ’MSG_MAP’,<br />

from_schema => ’AQ’,<br />

from_type => ’PO_ORDER1’,<br />

to_schema => ’AQ’,<br />

to_type => ’PO_ORDER2’,<br />

transformation => ’AQ.MAP_PO_ORDER (source.user_data)’),<br />

END;<br />

Java (JDBC): Enqueue a message (add payload)<br />

/* Setup */<br />

connect system/manager<br />

create user aq identified by aq;<br />

grant aq_administrator_role to aq;<br />

public static void setup(AQSession aq_sess) throws AQException<br />

{<br />

AQQueueTableProperty qtable_prop;<br />

AQQueueProperty queue_prop;<br />

AQQueueTable q_table;<br />

AQQueue queue;<br />

AQAgent agent;<br />

qtable_prop = new AQQueueTableProperty("RAW");<br />

q_table = aq_sess.createQueueTable ("aq", "rawmsgs_qtab", qtable_prop);<br />

11-18 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!