From fe18d3a6290084e42037949188527e88049cb2ce Mon Sep 17 00:00:00 2001 From: Matt Hadden Date: Thu, 5 Dec 2024 13:51:11 -0500 Subject: [PATCH 1/2] refactor(amqp): update alerts subtopic --- src/lib/amqp/sarra-canada-amqp.js | 2 +- src/lib/eccc/alertMonitor.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/amqp/sarra-canada-amqp.js b/src/lib/amqp/sarra-canada-amqp.js index eb5283d0..34769403 100644 --- a/src/lib/amqp/sarra-canada-amqp.js +++ b/src/lib/amqp/sarra-canada-amqp.js @@ -17,7 +17,7 @@ export function listen(options) { let amqp_port = 5671; let amqp_user = "anonymous"; let amqp_password = "anonymous"; - let amqp_subtopic = "#"; + let amqp_subtopic = "*.WXO-DD.#"; let amqp_queue = null; let amqp_expires = 10800000; // three hours in milliseconds let amqp_reconnect_limit_ms = 120000; diff --git a/src/lib/eccc/alertMonitor.ts b/src/lib/eccc/alertMonitor.ts index c640a0a9..723fbc2c 100644 --- a/src/lib/eccc/alertMonitor.ts +++ b/src/lib/eccc/alertMonitor.ts @@ -31,7 +31,7 @@ class AlertMonitor { // hook up the amqp listener const { connection, emitter: listener } = listen({ - amqp_subtopic: `alerts.cap.#`, + amqp_subtopic: `*.WXO-DD.alerts.cap.#`, }); // handle errors and messages From 09882a66a42794b24e3d02fab7de8d53fead8ee6 Mon Sep 17 00:00:00 2001 From: Matt Hadden Date: Thu, 5 Dec 2024 14:09:07 -0500 Subject: [PATCH 2/2] refactor(amqp): update conditions subtopic --- src/lib/eccc/conditions.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/eccc/conditions.ts b/src/lib/eccc/conditions.ts index 806ba8fa..02db617c 100644 --- a/src/lib/eccc/conditions.ts +++ b/src/lib/eccc/conditions.ts @@ -92,7 +92,7 @@ class CurrentConditions { // hook up the amqp listener const { connection, emitter: listener } = listen({ - amqp_subtopic: `citypage_weather.xml.${config.primaryLocation.province}.#`, + amqp_subtopic: `*.WXO-DD.citypage_weather.xml.${config.primaryLocation.province}.#`, }); // handle errors and messages @@ -102,7 +102,7 @@ class CurrentConditions { // make sure its relevant to us if (!url.includes(`${this._weatherStationID}_e.xml`)) return; - this.fetchConditions(); + this.fetchConditions(url); logger.log("Received new conditions from AMQP at", date); }); @@ -112,9 +112,9 @@ class CurrentConditions { logger.log("Started AMQP conditions listener"); } - private fetchConditions() { + private fetchConditions(url: string = this._apiUrl) { axios - .get(this._apiUrl) + .get(url) .then((resp) => { // parse to weather object const weather = new Weather(resp.data);