Publishing a Message to a Topic

This real-time data function allows you to build a messaging construct that broadcasts messages to multiple subscribers 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. 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.

To publish a message to a topic:

  1. From Database Explorer under the ASE connection profile, expand the Procedures and Functions folder or, for triggers, expand the Tables folder and expand the table, then the Triggers folder.

  2. Select the procedure or trigger to which you want to add messaging syntax. Right-click and select Edit Procedure. Alternatively, select the trigger to which you want to add messaging syntax. Right-click and select Edit Trigger. The procedure or trigger code appears in SQL Editor.

  3. Place the cursor in the desired location within the SQL code, right-click and select Real-time Messaging Wizard. You can also open the wizard from the ASE Real-Time Messaging Wizard icon on the toolbar.

    The Select a Wizard dialog appears. If Publish a Message is not visible, expand the Real-time Data Functions|Topic-related Functions folders first.

  4. Select 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. Database Development automatically populates the read-only fields 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:

    OptionAction
    VariableProvides 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.
    TextEnter the message text or use the Browse feature to locate a text file for the message body.
    ByteEnter 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 StatementWhen 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. Choose among the three tabs:

    TabDescription
    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.

    PropertiesThe 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 PropertiesClick 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 in SQL Editor.

    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.

Registering a Subscription

Creating an ASE Connection Profile

Creating a JMS Connection Profile

Using Visual SQL to Edit a Procedural Object

Real-Time Messaging Services

See the Adaptive Server Enterprise Messaging Services User's Guide for Real-Time Data Services.

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com