Publishing a Message to a Topic

Sybase WorkSpace enables you to create the SQL code for publishing a message to a topic. You can build a messaging construct that broadcasts messages to multiple subscribes rather than sending it to a single endpoint. It follows a one-to-many model rather than a one-to-one model of real-time messaging.

Prerequisites 

To publish a message to a topic, you must have connection profiles for TIBCO JMS and Adaptive Server Enterprise running with real-time messaging configured. A subscription must be available in the JMS server to serve as an endpoint. In addition, you must have topics to which you can subscribe and have registered a subscription for those topics. See the your TIBCO documentation for information on creating a topic in JMS.

  1. From Enterprise Explorer, find the ASE connection profile and expand the tree for the database and appropriate schema owner.
  2. Select the procedural object for which you want to add messaging syntax, right-click, and select Edit.

    Stored procedures reside in the Stored Procedures folder. For Triggers, expand the table and then the Triggers folder.

    The procedure or trigger code appears in its corresponding editor.

  3. Place the cursor in the desired location within the SQL code, right-click and select Sybase_ASE_15.x > Real-time Messaging Wizard .

    You can also open the wizard from the icon on the toolbar.

    The Select a Wizard dialog appears.

  4. Select Topic-related functions > Publish a message, and click Next.

    The Specify Subscription dialog appears.

  5. In Subscription Name, select the subscription name associated with the topic to which you want to publish a message. The read-only fields populate in the Subscription Information field. The read-only Preview box automatically displays the SQL code generated by your actions.
  6. Click Next.

    The Specify Message Body dialog appears.

  7. In the Specify Message Body dialog, select one of the following options:
    Option Action
    Variable Provides a local variable or parameter form before the current cursor position. Choose the variable or parameter from the drop-down list. The variable or parameter you choose becomes the message body in the current procedural object definition.
    Text Enter the message text or use the Browse feature to locate a text file for the message body.
    Byte Enter the message body in hexadecimal format. You can also use the Browse button to locate a hexadecimal file that can be copied into the message body.
    Select Statement When you choose this option, the SQL button just below the Browse button is enabled. Select SQL... to invoke the Visual SQL dialog.
  8. Click Next.

    The Specify Message Options dialog appears.

  9. Specify the message options.
    Tab Description
    Options Contains the default JMS options:
    • Message Type: Select Text or Bytes as the message type.

    • Message Schema: Choose Use User-Defined Schema to activate the User-Defined Schema frame. Then use the Browse feature to locate the XML schema file.

    Properties The options in this dialog allow you to customize JMS system properties: Persistent Mode, Reply Queue, Reply Topic, Priority, Correlation ID, and Time-to-live. Sybase provides default values. To change these, use the drop-downs and check boxes where provided. The Correlation field remains dimmed unless you select its check box.
    User-Defined Properties Click Add to invoke the Property dialog. Enter the name and value of the property you want to add. Select the String Type check box if required. Click OK. The property name and value appears in the User Defined Properties table. To edit a property, select the property and click Edit, which displays the Property dialog. To delete the property, press Delete.
  10. Click Finish.

    The messaging constructs appear.

    Note: Because ASE messaging constructs are functions, select appears before the messaging construct. You can also assign the messaging function to a local variable that has already been declared.

    For more infomation, see the Adaptive Server Enterprise Messaging Services User's Guide for Real-Time Data Services.

Related concepts
Real-Time Messaging Services
Mapping Functions
Related tasks
Sending a Message to a JMS Queue
Receiving a Message from a JMS Queue
Sending a Message to a WebSphere MQ Queue
Receiving a Message from a WebSphere MQ Queue
Subscribing to a Topic
Consuming a Message from a Topic
Unsubscribing from a Topic
Registering a Subscription
Parsing an XML Document
Retrieving XML Message Properties
Related reference
Select for XML Statements

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.