From bcd816d67d8caa202357c0951dc86ff185f6075f Mon Sep 17 00:00:00 2001 From: saidone Date: Sat, 25 May 2024 12:37:13 +0200 Subject: [PATCH 1/2] update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bcef350..c78a3dd 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,9 @@ Alfresco: ```clojure (defn add-aspect [resource] - (let [aspect-names (get-in (nodes/get-node (:ticket @c/config) (:id resource)) [:body :entry :aspect-names])] + (let [aspect-names (get-in (nodes/get-node (c/ticket) (:id resource)) [:body :entry :aspect-names])] (->> (model/map->UpdateNodeBody {:aspect-names (conj aspect-names cm/asp-dublincore)}) - (nodes/update-node (:ticket @c/config) (:id resource))))) + (nodes/update-node (c/ticket) (:id resource))))) ``` Note that the (resource part of) message is automatically converted to a plain Clojure map with keys changed to kebab-case and keywordized thus looks like this (representing a node in this case): @@ -125,8 +125,8 @@ will look for ALF_USER and ALF_PASS environment variables if defined, otherwise Environment variables will win over the configuration files. Lastly `cral.config/configure` is called and an Alfresco ticket is requested and then stored in `:alfresco :ticket` -section of the map. It can be retrieved with `(get-in @c/config [:alfresco :ticket])` (assuming that config has been -imported as `[weller.config :as c]`). +section of the map. It can be retrieved with `(c/ticket)` (assuming that config has been imported as +`[weller.config :as c]`). ### Build and start a message pipe The standard constructor `make-pipe` will create a pipe that receives ActiveMQ messages. Then at least one tap must be connected using the function `add-filtered-tap` that takes a filter and a (processing) function as arguments (note that From 663ccb09194eaa55e53ada491916b1d442773e2f Mon Sep 17 00:00:00 2001 From: saidone Date: Sat, 25 May 2024 12:40:31 +0200 Subject: [PATCH 2/2] update docstrings --- src/weller/pipe.clj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/weller/pipe.clj b/src/weller/pipe.clj index 23c2a56..a0343c5 100644 --- a/src/weller/pipe.clj +++ b/src/weller/pipe.clj @@ -49,13 +49,13 @@ :running false)))) (defn make-tap - "Return a filtered tap connected to the `mult` channel. + "Returns a filtered tap connected to the `mult` channel. The tap is filtered by predicate `pred`." [mult pred] (a/tap mult (a/chan 1 (filter pred)))) (defn add-filtered-tap - "Add a filtered (by `pred`) tap to the pipe. Filtered messages are processed by function `f`." + "Adds a filtered (by `pred`) tap to the pipe. Filtered messages are processed by function `f`." [this pred f] (if (:running this) (do @@ -64,15 +64,15 @@ (assoc this :taps (conj (:taps this) (mh/make-handler (make-tap (:mult this) pred) f))))) (defn remove-taps - "Stop the pipe if running and remove all taps from it." + "Stops the pipe if running and removes all the taps from it." [this] (if (:running this) (assoc (component/stop this) :taps []) (assoc this :taps []))) (defn make-pipe - "Create a pipe with a built-in ActiveMQ listener. - If a predicate `pred` and a function `f` are provided, then also add a filtered tap to it and start the pipe." + "Creates a pipe with a built-in ActiveMQ listener. + If a predicate `pred` and a function `f` are provided, then also adds a filtered tap to it and starts the pipe." ([] ;; load configuration (c/configure)