Skip to content

Commit

Permalink
Merge pull request #62 from saidone75/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
saidone75 authored May 25, 2024
2 parents f829aef + 663ccb0 commit bec1d28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/weller/pipe.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit bec1d28

Please sign in to comment.