Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

tbt-post/consul-clj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Consul agent client for clojure

Any clojure service can register and send heartbeats to consul agent.

Start continuous heartbeat

Service will be registered initially. If consul or third party deregisters service, registration will be renewed"

(start-heartbeat {:name                              "my-service" ; service name, required
                  :id                                "my-service@127.0.0.1:8081"  ; id must be unique for agent, defaults to service name
                  :address                           "127.0.0.1"  ; service remote address
                  :port                              8081
                  :ttl                               "15s"        ; timeout since last heartbeat to set critical state
                  :deregister-critical-service-after "1m"         ; timeout for consul to deregister service in critical state
                  :interval-ms                       7500})       ; heartbeat interval, milliseconds

Stop continuous heartbeat

(stop-heartbeat "my-service")

Single hearbeat

Service will be registered if not registered yet.

(heartbeat {:name                              "my-service"
            :id                                "my-service@127.0.0.1:8081"
            :address                           "127.0.0.1"
            :port                              8081
            :ttl                               "15s"
            :deregister-critical-service-after "1m"})