|
1 | 1 | # Integrant implementation |
2 | 2 |
|
3 | | -Define |
| 3 | +Define |
4 | 4 |
|
5 | 5 | * an integrant system configuration in `resources/config.edn` |
6 | 6 | * Integrant `init-key` used to start each component |
7 | 7 | * Integrant `halt-key!` to stop each component |
8 | | -* Define `-main` function to load the system configuration, optionally parse with aero, start all components and hold a reference to the running system that listens to SIGTERM events |
| 8 | +* Define `-main` function to load the system configuration, optionally parse with aero, start all components and hold a reference to the running system that listens to SIGTERM events |
9 | 9 |
|
10 | 10 |
|
11 | 11 | ## Prepare system |
@@ -72,9 +72,13 @@ HTTP server start - returns function to stop the server |
72 | 72 | (defmethod ig/init-key ::http-server |
73 | 73 | [_ {:keys [handler port join?]}] |
74 | 74 | (mulog/log ::http-server-component :handler handler :port port :local-time (java.time.LocalDateTime/now)) |
75 | | - (http-server/run-server handler {:port port :join? join?})) |
| 75 | + (http-server/run-server #'handler {:port port :join? join?})) |
76 | 76 | ``` |
77 | 77 |
|
| 78 | +!!! HINT "Quote handler function to evaluate changes" |
| 79 | + Use `#'` reader quote when passing the `handler` function to the server so that changes to the code called by the handler function can be updated by evaluating those changes in the REPL. |
| 80 | + |
| 81 | + |
78 | 82 | ## Shutdown Components |
79 | 83 |
|
80 | 84 | Define how each component should be halted (if required) |
@@ -181,11 +185,11 @@ Shutdown the mulog event publisher process, including a `(Thread/sleep 250)` to |
181 | 185 | (:require |
182 | 186 | ;; Component system |
183 | 187 | [{{top/ns}}.{{main/ns}}.parse-system :as parse-system] |
184 | | - |
| 188 | + |
185 | 189 | ;; System dependencies |
186 | 190 | [integrant.core :as ig] |
187 | 191 | [com.brunobonacci.mulog :as mulog])) |
188 | | - |
| 192 | + |
189 | 193 | ;; -------------------------------------------------- |
190 | 194 | ;; Configure and start application components |
191 | 195 |
|
@@ -247,4 +251,3 @@ Shutdown the mulog event publisher process, including a `(Thread/sleep 250)` to |
247 | 251 | (ig/halt! system)) |
248 | 252 | ;; -------------------------------------------------- |
249 | 253 | ``` |
250 | | - |
|
0 commit comments