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.

Creating a Remote Subscriber for Topics of JMS Messages<br />

Purpose<br />

Create a remote subscriber for topics of jms messages without selector.<br />

Usage Notes<br />

AQ allows topics to have remote subscribers, for example, subscribers at other<br />

topics in the same or different database. In order to use remote subscribers, you<br />

must set up propagation between the local and remote topic.<br />

Remote subscribers may be a specific consumer at the remote topic or all<br />

subscribers at the remote topic. A remote subscriber is defined using the<br />

AQjmsAgent structure. An AQjmsAgent consists of a name and address. The name<br />

refers to the consumer_name at the remote topic. The address refers to the remote<br />

topic - the syntax is (schema).(topic_name)[@dblink].<br />

a) To publish messages to a particular consumer at the remote topic, the<br />

subscription_name of the recipient at the remote topic must be specified in the<br />

name field of AQjmsAgent. The remote topic must be specified in the address field<br />

of AQjmsAgent<br />

b) To publish messages to all subscribers of the remote topic, the name field of<br />

AQjmsAgent must be set to null. The remote topic must be specified in the address<br />

field of AQjmsAgent<br />

A message selector can also be specified. Only messages that satisfy the selector are<br />

delivered to the remote subscriber. The message selector can be null. The syntax for<br />

the selector is the same as that for createDurableSubscriber. The selector can be null.<br />

Syntax<br />

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

AQjmsSession.createRemoteSubscriber<br />

Example<br />

TopicConnectionFactory tc_fact = null;<br />

TopicConnection t_conn = null;<br />

TopicSession t_sess = null;<br />

TopicSession jms_sess;<br />

TopicSubscriber subscriber1;<br />

Topic shipped_orders;<br />

int my[port = 5521;<br />

AQjmsAgent remoteAgent;<br />

/* create connection and session */<br />

JMS Operational Interface: Basic Operations (Publish-Subscribe) 15-35

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

Saved successfully!

Ooh no, something went wrong!