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.

Sending Messages Using a Queue Sender by Specifying Send Options<br />

Purpose<br />

Send messages using a queue sender by specifying send options.<br />

Usage Notes<br />

If the QueueSender has been created with a default queue, then the queue<br />

parameter may not necessarily be supplied in the send call. If a queue is specified in<br />

the send operation, then this value will override the default queue of the<br />

QueueSender.<br />

If the QueueSender has been created without a default queue, then the queue<br />

parameter must be specified in every send call.<br />

Syntax<br />

Java (JDBC): <strong>Oracle</strong>9i Supplied Java Packages Reference oracle.jms,<br />

AQjmsQueueSender.send<br />

Example<br />

See Also:<br />

Table 14–1 for a list of JMS operational interface basic<br />

<br />

operations<br />

"Interface - javax.jms.QueueSender" on page B-33<br />

Example1<br />

/* Create a sender to send messages to any queue */<br />

/* Send a message to new_orders_que with priority 2 and timetoLive 100000<br />

milliseconds */<br />

QueueSession jms_sess;<br />

QueueSender sender1;<br />

TextMessage mesg;<br />

Queue new_orders_que<br />

sender1 = jms_sess.createSender(null);<br />

sender1.send(new_orders_que, mesg, DeliveryMode.PERSISTENT, 2, 100000);<br />

Example2<br />

/* Create a sender to send messages to a specific queue */<br />

/* Send a message with priority 1 and timetoLive 400000 milliseconds */<br />

QueueSession jms_sess;<br />

QueueSender sender2;<br />

14-14 <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!