Skip to content

Commit 04b5be0

Browse files
committed
immutant web server
-stop method
1 parent 9fe3556 commit 04b5be0

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
** 0.4.2-SNAPSHOT
33
- Handler component has an option to disable shared root middleware
44
- Fix: https://github.com/danielsz/system/issues/120
5+
- New Riemann client component
56
** 0.4.1
67
- REPL server with bind address option
78
- Cider REPL server with bind address option

README.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- [[https://github.com/Factual/durable-queue][Durable Queue]] (Factual’s disk-backed task queue)
3232
- [[https://github.com/danielsz/benjamin][Benjamin]] (Idempotency with side-effects)
3333
- [[http://www.lambda.cd/][LambdaCD]] (build pipelines as code)
34+
- [[https://github.com/riemann/riemann-clojure-client][Riemann client]] (client for the network event stream processing system)
3435
** Motivation
3536
A good REPL experience is a prerogative of Lisp languages. [[https://github.com/stuartsierra/reloaded][Reloaded]] components enable this goodness in Clojureland. Since they require an amount of setup, the first steps when starting a new project are generally devoted to infrastructure. My first attempt to tackle the boilerplate was a Leiningen [[https://github.com/danielsz/back-end-template][template]]. The problem is that Leiningen templates are hard to maintain and difficult to retrofit on existing projects. I was finding myself repeatedly updating the template for future use. Then it dawned on me that a library would better fit the bill. And so *system* came to light. It’s now the first dependency I add to any project, allowing me to focus from the get-go on the substance of my application.
3637
** Is it good?

project.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
[com.taoensso/sente "1.8.1"]
3232
[org.danielsz/etsy "0.1.2"]
3333
[org.danielsz/benjamin "0.1.0-SNAPSHOT"]
34+
[riemann-clojure-client "0.4.5"]
3435
[compojure "1.4.0"]
3536
[http-kit "2.1.19"]
3637
[lambdacd "0.13.2"]

src/system/components/immutant_web.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
[lang-utils.core :refer [∘ seek]]
66
[immutant.web :refer [run stop]]))
77

8-
(defrecord WebServer [handler server options]
8+
(defrecord WebServer [handler options]
99
component/Lifecycle
1010
(start [component]
1111
(let [handler (if (fn? handler) handler (:handler (val (seek ( :handler val) component))))
1212
server (run handler options)]
1313
(assoc component :server server)))
1414
(stop [component]
15-
(when server
16-
(stop server)
15+
(if-let [server (:server component)]
16+
(assoc component :server (stop server))
1717
component)))
1818

1919
(def Options

src/system/monitoring/scheduled_executor_service.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(ns system.monitoring.scheduled-executor-service
2-
(:require [system.monitoring.core :as m])
2+
(:require [system.monitoring.core :as c])
33
(:import [system.components.scheduled_executor_service Scheduler]))
44

55
(extend-type Scheduler
6-
m/Monitoring
6+
c/Monitoring
77
(started? [component]
88
(not (.isShutdown (:scheduler component))))
99
(stopped? [component]

0 commit comments

Comments
 (0)