Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tbt-post/consul-clj


https://github.com/tbt-post/consul-clj

clj consul-agent microservice tbt-cloud

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

= 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"

[source,clojure]
----
(start-heartbeat {:name "my-service" ; service name, required
:id "[email protected]: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

[source,clojure]
----
(stop-heartbeat "my-service")
----

== Single hearbeat

Service will be registered if not registered yet.

[source,clojure]
----
(heartbeat {:name "my-service"
:id "[email protected]:8081"
:address "127.0.0.1"
:port 8081
:ttl "15s"
:deregister-critical-service-after "1m"})
----