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.

Adding a Subscriber<br />

}<br />

AQQueueTable q_table;<br />

AQQueue queue;<br />

/* Create a AQQueueTable property object */<br />

qtable_prop = new AQQueueTableProperty("AQ.MESSAGE_TYP");<br />

qtable_prop.setMultiConsumer(true);<br />

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

/* Create a new AQQueueProperty object: */<br />

queue_prop = new AQQueueProperty();<br />

queue = aq_sess.createQueue (q_table, "multi_queue", queue_prop);<br />

/* Add subscribers to a queue */<br />

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

{<br />

AQQueue queue;<br />

AQAgent agent1;<br />

AQAgent agent2;<br />

}<br />

/* Get the queue object */<br />

queue = aq_sess.getQueue("AQ", "multi_queue");<br />

/* add a subscriber */<br />

agent1 = new AQAgent("subscriber1", "aq2.msg_queue2@london");<br />

queue.addSubscriber(agent1, null);<br />

/* add a subscriber with a rule */<br />

agent2 = new AQAgent("subscriber2", "aq2.msg_queue2@london");<br />

queue.addSubscriber(agent2, "priority < 2");<br />

/* Add a subscriber with a rule */<br />

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

{<br />

AQQueue queue;<br />

AQAgent agent1;<br />

/* Get the queue object */<br />

queue = aq_sess.getQueue("OE", "OE_bookedorders_que");<br />

/* add a subscriber */<br />

9-62 <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!