Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Sample programs for a publish / subscribe server

These sample programs are intended to illustrate how to implement a simple publish and subscribe service in a UTM application.

Function

A user can subscribe to a service. That user then receives all messages published as of that time in their USER queue.
The possible commands for this service are:

  • help: Get help text

  • subscribe: Subscribe to messages

  • unsubscribe: Cancel subscription to messages

  • who: Output the names of the subscribers

  • publish <message>: Publish a message

The service is provided by an asynchronous service with the TAC PUBSUBA which constantly listens for jobs at the TAC queue PUBSUBMQ. Users communicate with the service over the dialog service PUPSUBD. Job confirmations are sent to the USER queue of the user and can, for instance, be read using the dialog program UPDGET (see sample programs for asynchronous processing for a UPIC client). In addition, PU can be queried in the INIT of each program unit to establish whether messages are waiting in the user's queue.

The service need only be started once by calling the TAC PUBSUBA. The open asynchronous service is then retained throughout the entire duration of the application. It is transferred to the new application by KDCUPD when a new generation is performed.

If the asynchronous service terminates abnormally as the result of an error, the most recently processed job is placed in the dead letter queue.

Delivery

On BS2000 systems, source programs and object modules are supplied as members of the library SYSLIB.UTM.070.EXAMPLE.

Element

LMS type

Meaning

PUBSUBD.C

S

Issues a request to the publish/subscribe service, dialog program unit

PUBSUBA.C

S

Implements the publish/subscribe service, asynchronous program unit

PUBSUBD#LLM

R

Object module for PUBSUBD.C

PUBSUBA#LLM

R

Object module for PUBSUBA.C

UTM generation

The statements for the program units in the KDCDEF run are specified as comments in the individual source files. This also applies to the statement for the TAC queue "PUBSUBMQ".

At least one GSSB must be generated (MAX GSSBS), as the service uses the GSSB "PUBSUBGB" to manage the subscribers.

If the most recently processed job is to be placed in the dead letter queue after the service is cancelled, MAX REDELIVERY = (...,0) must be generated. Is this is not done, the job remains in the job queue PUBSUBMQ.