Services

A Service is a sub process within the application that can be specific to publishing/subscribing streams of data to/from Diffusion server. It represents a functional unit to perform specific type of tasks.

A service could publish or subscribe to Diffusion topics or do both. Depending on this, they are categorised into different service modes in the framework. They are as follows:

  • Source mode: This consumes data from an external data source and publishes it to Diffusion. These are further categorised as:

    • Streaming Source: In streaming mode, the service is notified of updates to data and publishes to Diffusion as updates arrive.

    • Polling Source: In polling mode, the service periodically polls an external data source and publishes updates to Diffusion.

  • Sink mode: In sink mode, the service consumes data from a Diffusion topic and publishes it to a back-end system.

  • Hybrid mode: In hybrid mode, the service consumes data from a Diffusion topic, performs any data manipulation, as required, and publishes the data to another Diffusion topic in same Diffusion server. It is a combination of Sink mode and Streaming source mode.

Service types

Different functionalities of an application can be separated into Service Types. When writing an application, developers can define different types of services of different modes, depending on the requirement for the application. A Service Type will be of a specific service mode and can require specific configuration parameters for its function.

For example, for the Kafka adapter, which consumes data from a Kafka cluster and publishes them to Diffusion topics, one Service Type defined in the application can be called "KafkaConsumer". This Service Type would be of streaming mode, as it would stream updates from Kafka topics and publish to Diffusion. For this functionality, it would require connection details to connect to Kafka, Kafka topic name to stream data from, other details about the topic, name of the Diffusion topic to publish to, etc. All these details, required for this Service Type to function, would be constituted as configuration parameters for this Service Type.

See here for details on how to define Service Types for a Gateway application, when writing one.

Developers should document Service Types the application supports and any configuration parameters they require.

Service type usage

Application users can create multiple services or service instances, for specific Service Types in an application with different configuration parameters. A service instance is a parameterised instance of Service Type and is identified by a unique name. Each service instance has its type, name, description and configuration, added to the overall application configuration. Services can be added during application startup in a configuration file or during runtime via the Diffusion Management console. The service can also be updated or removed during runtime.

In addition, service instances can be paused or resumed by a user at runtime, using the Diffusion Management console. See Service operations for more details.

To add a service instance in a Gateway application, users should consult the application documentation to understand supported Service Types and their required configuration parameters. Each service mode requires additional configuration parameters defined by the Gateway Framework. See configuration for services for more details.