Skip to main content

Messaging Service Client SDK

Client library for accessing the realtime messaging services of the SmartOcean platform.

The messaging services rely on the MQTT Standard

This client SDK implementation utilises the Paho MQTT library. The Paho MQTT library may also be used directly to access the messaging services in case more advanced use is required.

Credentials

Credentials for accessing the messaging service being consumed must be placed in a .env file with the following content

BROKER_USERNAME=<username>
BROKER_PASSWORD=<password>

Configuration

Broker configuration information must be provided in a yaml configuration file with the following format:

BROKER_HOST: 
BROKER_PORT: 
BROKER_TOPIC: 
TOPIC_QOS: 
CLIENT_ID: 

The name of the configuration file in the example below is to be provided as a command-line argument when running the Python application.

Sample Subscriber

A sample implementation accessing the messaging service as a subscriber:

import sfisop.messaging_sdk.subscriber as mqtt_subscriber
import sfisop.messaging_sdk.configuration as mqtt_configuration

import logging

logging.basicConfig(filename='subscriber_client.log',
                    format="%(asctime)s[%(levelname)s]:%(message)s", encoding='utf-8',
                    level=logging.DEBUG)

logging.info("MQTT Subscriber Client module")


class DataConsumer(mqtt_subscriber.SubscriberClient):

    def __init__(self, config_file : str):

        mqtt_client_config = mqtt_configuration.ClientConfiguration(config_file)

        super().__init__(mqtt_client_config)

    def process_one(self, in_message):

        logging.info(f'Data Consumer process_one: {in_message}')


if __name__ == '__main__':

    config_file = mqtt_configuration.get_config_file()

    data_consumer = DataConsumer(config_file)

    data_consumer.run()

Sample Publisher

A sample implementation accessing the messaging service as a publisher:

from sfisop.messaging_sdk.publisher import PublisherClient
from sfisop.messaging_sdk.configuration import ClientConfiguration, get_config_file

if __name__ == '__main__':

    config_file = get_config_file()

    config = ClientConfiguration(config_file)

    publisher_client = PublisherClient(config)

    publisher_client.publish_one("Hello World Publisher Client")

Metadata

Release files for sfisop-messaging-sdk 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sfisop-messaging-sdk 1.0.3
File Size Uploaded
sfisop_messaging_sdk-1.0.3.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sfisop-messaging-sdk 1.0.3
File Interpreter ABI Platform
sfisop_messaging_sdk-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / sfisop_messaging_sdk-1.0.3.tar.gz

Download URL sfisop_messaging_sdk-1.0.3.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
af310ee8e8fc2073aa00059dd3eba099dcd023877b847938b158e4e671a54afd
BLAKE2b-256 checksum
How to use checksums
da049d93eeb340ab9b92b7ee6ca75b51392058c5b7cb173ac9829d4ea867a4b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/24.2.0

Release files / sfisop_messaging_sdk-1.0.3-py3-none-any.whl

Download URL sfisop_messaging_sdk-1.0.3-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1fe83915350cc6070fbe7a78690a44e0fd2d2f14ccea7fb794e3687b76abb32
BLAKE2b-256 checksum
How to use checksums
09d2636c5a5c0243c5d6d071c2d45168ce8ba22c7ddceb5cd78f805443d6974a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/24.2.0

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page