Download Oracle Streams Advanced Queuing User's Guide and Reference
Transcript
Creating a Remote Subscriber for JMS Messages
TopicSubscriber
Topic
AQjmsAdtMessage
subscriber;
topic;
msg = null;
try
{
/* get a handle to the OE_bookedorders_topic */
topic = ((AQjmsSession)jms_session).getTopic("OE", "OE_bookedorders_topic");
/* create a subscriber with the transformation OE2WS */
subs = ((AQjmsSession)jms_session).createDurableSubscriber(
topic, 'WShip', null, false, WSOrder.getFactory(), "OE2WS");
msg = subscriber.receive(10);
}
catch (JMSException ex)
{
System.out.println("Exception :" ex);
}
return (AQjmsAdtMessage)msg;
}
Creating a Remote Subscriber for JMS Messages
public void createRemoteSubscriber(javax.jms.Topic topic,
oracle.jms.AQjmsAgent remote_subscriber,
java.lang.String messageSelector)
throws JMSException
This method creates a remote subscriber for topics of JMS messages. It has the
following parameters:
Parameter
Description
topic
Topic to subscribe to
remote_subscriber AQjmsAgent that refers to the remote subscriber
messageSelector
See Also:
Only messages with properties matching the messageSelector
expression are delivered. A value of null or an empty string indicates
that there is no messageSelector for the message consumer.
"MessageSelector" on page 11-17
Oracle Streams AQ allows topics to have remote subscribers, for example, subscribers
at other topics in the same or different database. In order to use remote subscribers,
you must set up propagation between the local and remote topic.
Remote subscribers can be a specific consumer at the remote topic or all subscribers at
the remote topic. A remote subscriber is defined using the AQjmsAgent structure. An
AQjmsAgent consists of a name and address. The name refers to the consumer_name
at the remote topic. The address refers to the remote topic. Its syntax is
schema.topic_name[@dblink].
To publish messages to a particular consumer at the remote topic, the
subscription_name of the recipient at the remote topic must be specified in the
name field of AQjmsAgent, and the remote topic must be specified in the address
field. To publish messages to all subscribers of the remote topic, the name field of
AQjmsAgent must be set to null.
Oracle JMS Publish/Subscribe 14-13