Receiving a Message from a JMS Queue

This real-time data function receives a message, which can be defined in a stored procedure, or trigger, from a specified endpoint in a JMS queue. To receive a message from a JMS queue, you must have TIBCO JMS running and an open Adaptive Server Enterprise connection profile with Real-Time Messaging configured. A message receiver/queue must be available in the JMS server to serve as the endpoint, or destination, for the received message.

To receive a message from a JMS Queue:

  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 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 in the code, right-click and select Real-time Messaging Wizard from the context menu. The wizard can also be invoked from the ASE Real-Time Messaging Wizard icon on the toolbar. The Select a Wizard dialog appears. Double-click the Receive a Message function; if the Receive a Message function is not visible, expand the Real-time Data Functions|Queue-Related Functions folders first.

  4. Select Receive a Message and click Next. The Specify Endpoint dialog appears.

  5. Select an available JMS provider using the drop-down in the JMS Connection Profile field. If, however, you select an Adaptive Server Enterprise, you must map the messaging provider to the profile. Press Create... to invoke the New JMS Connection Profile wizard.

    Once a profile is chosen, the Provider Class and Provider URL fields are filled in automatically.

  6. Select a queue from the Queue drop-down.

  7. (Optional) When the Authentication check box is selected, provide a user name and password that are configured on the TIBCO JMS provider.

  8. The Preview box displays the existing SQL constructs. Click Next. The Receive a Message from a Queue page appears.

    Skip to step 12 if you have no properties to set.

  9. (Steps 8 through 11 are optional, depending on applicability.) In the Selector box, choose the first row in the Property Name column and right-click to invoke the drop-down. Select a property from the available options.

  10. Perform the same action in step 8 for the other columns: Operator, Value, and Logical. Select the appropriate element from the drop-down from each column for each row that you are declaring a property.

  11. In the Options box select the applicable check boxes: In the Timeout field, choose the number of days, hours, minutes, and seconds you want the message to remain in the queue. Use the arrow keys to incrementally change the numbers. If you selected the Resend Message To check box, select from the drop-down at the right of its field the endpoint to which you want the message resent.

  12. (Optional) Use the drop-down list to select from the Return Datatype field the datatype in which you want the message received.

  13. Click Finish. The messaging constructs appear in the Editor view.

    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.

Enabling ASE Real-Time Messaging Services

Creating a JMS Connection Profile

Sending a Message to a JMS Queue

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