wmo-im / wis2downloader

The backend Python package for downloading real-time data from the WIS2 network.
Apache License 2.0
1 stars 1 forks source link

Save subscriptions on change #12

Closed david-i-berry closed 5 months ago

david-i-berry commented 5 months ago

Topics added to the active subscriptions need to be saved so that on restart the user does not need to re-subscribe manually.

maaikelimper commented 5 months ago

create topics.json with topics separate from config.json

david-i-berry commented 5 months ago

Example json file:

{
    "topics": {
        "origin/a/wis2/+/data/core/weather/surface-based-observations/synop": "$TOPIC"
    }, 
    "client_id": "20363bd5-d436-40ee-a60f-b135076b6bec"
}

I've included a client / session id for persisting between runs. Path to file specified in config.json (defaulting to .mqtt_session.json if not specified).

config.json:

{
    ...
    "session_info": ".mqtt_session.json"
    ...
}
maaikelimper commented 5 months ago

subscriptions are save in a mqtt_session_info.json

https://github.com/wmo-im/wis2downloader/pull/18