diff --git a/src/milquetoast/client.clj b/src/milquetoast/client.clj index 17d3fad..01a7f27 100644 --- a/src/milquetoast/client.clj +++ b/src/milquetoast/client.clj @@ -6,7 +6,7 @@ org.eclipse.paho.client.mqttv3.persist.MemoryPersistence java.time.Instant)) -(defn- create-mqtt-client! +(defn create-mqtt-client! "Creates and connects an MQTT client with the provided broker URI, username, and password." [& {:keys [broker-uri username password]}] (let [client-id (MqttClient/generateClientId) @@ -20,7 +20,7 @@ (doto (MqttClient. broker-uri client-id (MemoryPersistence.)) (.connect opts)))) -(defn- retry-attempt +(defn retry-attempt "Attempts to execute function `f`. If `f` throws a RuntimeException, logs the exception and attempts to reconnect before retrying `f`." [verbose f reconnect] (let [wrapped-attempt (fn [] @@ -42,7 +42,7 @@ ( (Runtime/getRuntime) (.availableProcessors) (+ 1))) @@ -125,7 +125,7 @@ (async/pipeline (parallelism) out xf in) out)) -(defn- json-parse-message [msg] +(defn json-parse-message [msg] (-> msg (update :payload (fn [payload] (json/read-str payload :key-fn keyword)))