On demand publication

In some cases, the requirement could be to publish to topics on the target server only if there is a demand for that topic, i.e., only if there is a subscription to a topic path but the topic is not yet present in the target server. The configuration parameter onDemandPublication can be used to enable this option. If this configuration is specified, there will not be an immediate subscription on topic selectors on the source server. Once a subscription to any topic path that is a part of triggerTopicBranch occurs and the topic is not present in the target server, then the subscribed topic in the target server will be subscribed to in the source server and updates are published to the target server (given that it is present in the source server).

    {
      "serviceName": "onDemandFxPublisher2",
      "description": "",
      "serviceType": "STREAM_FROM_REMOTE",
      "config": {
        "sharedConfigName": "remoteDiffusionServer",
        "application": {
          "topicMappingFunction": "<path(0)>",
          "replicateTopicType": true,
          "onDemandPublication": {
            "triggerTopicBranch": "fx/"
          }
        }
      }
    }

In another scenario, the demand on a topic in a target server can be treated as a trigger to publish to a completely different topic tree. For this case, diffusionTopicSelector can be specified together with the onDemandPublication configuration parameter. With this combination, if there is a subscription to any topic path in the target server that is a part of triggerTopicBranch, the specified diffusionTopicSelector will be subscribed to in the target server, and any topics matching the selector will be published to the target server as configured.

    {
      "serviceName": "onDemandFxPublisher",
      "description": "",
      "serviceType": "STREAM_FROM_REMOTE",
      "config": {
        "sharedConfigName": "remoteDiffusionServer",
        "application": {
          "diffusionTopicSelector": "?fx//",
          "topicMappingFunction": "<path(0)>",
          "replicateTopicType": true,
          "onDemandPublication": {
            "triggerTopicBranch": "fx/"
          }
        }
      }
    }

All service types supported by the Diffusion adapter support on-demand publication to the target server, which can be a remote server or a local server depending on the service type. The configuration parameter onDemandPublication can be used to specify the topic branch to trigger the publication to the target server.

onDemandPublication configuration
Name Type Description Mandatory Default value

triggerTopicBranch

String

A topic branch that triggers on-demand topic subscriptions to the source server and publication to the target server.

Yes

N/A

The diagram below illustrates the sequence of actions that take place when there is a subscription to a topic path that is part of the topic tree defined by the triggerTopicBranch and the topic is not present in the target server.

onDemandPublication