Publish-Subscribe integration (Pub/Sub)

pycsw supports Publish-Subscribe (Pub/Sub) integration by implementing the OGC API Publish-Subscribe Workflow - Part 1: Core (draft) specification.

Pub/Sub integration can be enabled by defining a broker that pycsw can use to publish notifications on given topics using CloudEvents (as per the specification).

When enabled, core functionality of Pub/Sub includes:

  • displaying the broker link in the OGC API - Records landing (using the rel=hub link relation)

  • sending a notification message on metadata transactions (create, replace, update, delete)

The following message queuing protocols are supported:

MQTT

Example directive:

pubsub:
    broker:
        type: mqtt
        url: mqtt://localhost:1883
        channel: messages/a/data  # optional
        show_link: false  # default true

HTTP

Example directive:

pubsub:
    broker:
        type: http
        url: https://ntfy.sh
        channel: messages-a-data  # optional
        show_link: true  # default true

Note

For any Pub/Sub endpoints requiring authentication, encode the url value as follows:

  • mqtt://username:password@localhost:1883

  • https://username:password@localhost

As with any section of the pycsw configuration, environment variables may be used as needed, for example to set username/password information in a URL. If pubsub.broker.url contains authentication, and pubsub.broker.show_link is true, the authentication information will be stripped from the URL before displaying it on the landing page.

Note

If a channel is defined, it is used as a prefix to the relevant OGC API endpoint is used.

If a channel is not defined, only the relevant OGC API endpoint is used.