Try OpenEdge Now
skip to main content
Messaging and ESB
ABL - JMS API Reference : subscribe procedure
 

subscribe procedure

Subscribes to a topic.

Syntax

PROCEDURE subscribe.
DEFINE INPUT PARAMETER topicName AS CHARACTER.
DEFINE INPUT PARAMETER subscriptionName AS CHARACTER.
DEFINE INPUT PARAMETER messageSelector AS CHARACTER.
DEFINE INPUT PARAMETER noLocalPublications AS LOGICAL.
DEFINE INPUT PARAMETER messageConsumer AS HANDLE.

Parameters

topicName
The topic to which the procedure subscribes.
subscriptionName
A subscriptionName parameter with a value other than UNKNOWN specifies a durable subscription. Durable subscriptions require that the JMS client have a client ID identifier; the client must call setClientID in the pubsubsession.p object (or set the default client ID on the server side). If the subscriptionName value is UNKNOWN, the subscription is not durable.
messageSelector
A message selector (optional).
noLocalPublications
A Boolean flag controlling whether the application receives its own messages (optional). The default is FALSE (the session receives its own publications).
messageConsumer
The Message Consumer object.

Applies to

Session objects

Notes

*The messages are handled asynchronously by the messageConsumer object.
*If the subscriptionName value is UNKNOWN or an empty string, the subscription is not durable.
*Durable subscriptions require the JMS client to have a client ID identifier.
*The client must call setClientIDprocedure in the pubsubsession object (or set the default client ID on the server side) if a durable subscription is desired. The default of noLocalPublications is FALSE. The session, by default, get its own publications.
*This procedure executes remotely (sends a message to the OpenEdge Adapter for SonicMQ).

See also

cancelDurableSubscription procedure, publishprocedure, subscribeprocedure
For more information, see the Publishing messages to a topic, the Subscribing to a topic, the Durable subscriptions, and the Methods unique to Pub/Sub messaging.
For an example, see the Pub/Sub messaging example.