Pub/Sub messaging example
- Last Updated: February 11, 2026
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Pub/Sub messaging example
A Pub/Sub messaging example consists of the basic steps described in this topic.
Creating a Pub/Sub session procedure
In the following example, the application creates a session object by
calling pubsubsession.p persistently.
|
Creating the session object specifies the connection parameters to the JMS-provider Broker. This allows an application to set different session-level attributes before starting the JMS session. The connection to the JMS-provider Broker and the JMS session does not occur until the application calls the beginSession procedure.
Connecting to the broker
The OpenEdge application connects to the JMS-provider Broker to begin exchanging messages, as follows:
|
Creating a Message Subscriber
You create a message subscriber to receive the message from the topic
newtopic. The subscriber handles the message using the
internal procedure myintproc, as shown in the following
example.
|
Subscribing to a topic
Applications subscribe to topics of interest. To subscribe to a topic, the application subscribes to a topic and prepares to receive messages from the topic, as shown in the following example.
|
Publishing to a topic
An application uses the publish procedure to publish messages to a topic, as shown in the following example.
|
Consuming messages from a topic
The Message Consumer receives a message from the topic and executes the business logic.
Deleting a message
The application deletes the messages after it finishes using them, as shown in the following example.
|
Pub/Sub messaging example summary
To see the full sample code for sending and receiving a message using a publisher/subscriber model, see Pub/sub messaging example summary.