Oracle8i Application Developer's Guide - Advanced Queuing
Release 2 (8.1.6)

A76938-01

Library

Product

Contents

Index

Prev Up Next

JMS Operational Interface: Basic Operations (Publish-Subscribe), 17 of 29


Create a Durable Subscriber for a JMS Topic With Selector

Figure 15-15 Use Case Diagram: Publish-Subscribe - Create a Durable Subscriber for a JMS Topic With Selector



To refer to the table of all basic operations having to do with the Operational Interface see:

  • "Use Case Model: Operational Interface -- Basic Operations"

 

Purpose

Create a durable subscriber for a jms topic with selector.

Usage Notes

The client creates a durable subscriber by specifying a subscriber name and JMS topic. Optionally, a message selector can be specified. Only messages with properties matching the message selector expression are delivered to the subscriber. The selector value may be null. The selector can contain any SQL92 expression which has a combination of one or more of the following:

  • User defined message properties

    For example:

    color IN ('RED', BLUE', 'GREEN') AND price < 30000 
    
    

    Operators allowed are:

    A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a different message selector. An unsubscribe call is needed to end the subscription to the topic.

    Syntax

    Example

    Example 1 - subscribe specifying selector
    
    TopicConnectionFactory    tc_fact   = null;
    TopicConnection           t_conn    = null;
    TopicSession              jms_sess;
    TopicSubscriber           subscriber1;
    Topic                     shipped_orders;
    int                       myport = 5521;
    AQjmsAgent[]              recipList;    
      
    /* create connection and session */
    tc_fact = AQjmsFactory.getTopicConnectionFactory("MYHOSTNAME",
                                                      "MYSID", myport, "oci8");
    t_conn = tc_fact.createTopicConnection("jmstopic", "jmstopic");
    jms_sess = t_conn.createTopicSession(true, Session.CLIENT_ACKNOWLEDGE);    
      
    shipped_orders = ((AQjmsSession )jms_sess).getTopic("OE", "Shipped_Orders_
    Topic");
    
    /* create a subscriber */
    /*  with condition on JMSPriority and user property 'Region' */
    subscriber1 = jms_sess.createDurableSubscriber(shipped_orders, 
    'WesternShipping',
                                    "JMSPriority > 2 and Region like 'Western%'", 
    false);
    
    

  • Prev Up Next
    Oracle
    Copyright © 1999 Oracle Corporation.

    All Rights Reserved.

    Library

    Product

    Contents

    Index