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 TIBCO documentation for information on creating a topic in JMS.

  1. For the appropriate ASE connection profile and database, select the appropriate procedural object.
    Object How to select
    Stored procedure Expand the Stored Procedures folder, right-click the stored procedure, and select Edit.
    Trigger Expand the Tables folder, expand the table, and then expand the Triggers folder. Right-click the trigger and select Edit.
  2. In the Source page, 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 theReal-Time Messaging Wizard icon ASE Real-Time Messaging Wizard icon on the toolbar.

  3. Select Topic-Related Functions > Publish a Message, and click Next.
  4. Select the Subscription Name associated with the topic to which you want to publish a message.
  5. Click Next.
  6. In the Specify Message Body dialog, select one of the following:
    Option Action
    Variable Select a local variable or parameter before the current cursor position. The selected variable or parameter becomes the message body in the current stored procedural object definition.
    Text Enter the message text, or use Browse to locate a text file for the message body.
    Bytes Enter the message body in hexadecimal format. You can also use Browse to locate a hexadecimal file that you can copy into the message body.
    Select Statement Select SQL... to invoke the Visual SQL dialog.
  7. Click Next to specify message options.
    Tab Description
    Options Contains the default JMS options:
    • Message Type – select Text or Bytes.

    • Message Schema – use User-Defined Schema to activate the User-Defined Schema frame. Use Browse to locate the XML schema file.

    Properties Customize JMS system properties: mode, priority, correlation, reply queue, reply topic, and time-to-live. Sybase provides default values that you can change. The Correlation field remains dimmed unless you select it.
    User-Defined Properties
    1. Click Add.
    2. Enter the name and value of the property you want to add.
    3. (Optional) Select String Type.
    4. Click OK.
  8. Click Finish.
    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

For product-related issues, contact Sybase Technical Support at 1-800-8SYBASE. Send your feedback on this help topic directly to Sybase Technical Publications: pubs@sybase.com