Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Basic registry operations for microservices in Clojure

License

NotificationsYou must be signed in to change notification settings

updcon/libpinkas-clj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Clojure library designed to support basic registry operationsfor microservices with Consul service by HashiCorp.

Heavily inspired by clj-consul-catalog.

libpinkas clj

Usage

project.clj
[updcon/libpinkas-clj"0.0.5"]
example.clj
(nsmy-app.jasper  (:require [libpinkas-clj.core:refer:all]            [clojure.core.async:refer [timeout <!!]:include-macrostrue]))(defn-schema [id port]  {:node"My-Node-Name":address"127.0.0.1":service {:id                  id:name                id:service"my-service":address"127.0.0.1":tags                ["primary"]:enable_tag_overridetrue:port                port}   })(def ^:privatepath"http://localhost:8500/v1/catalog/")(def ^:privateserv1 (service path (schema"my-service-1"8888)))(def ^:privateone-sec1000)(defnrun-my-service  (let [status (register serv1)]    (when status      (<!! (timeout one-sec)))    (assert (= (count (filter                        #(="my-service-1" (get %:ServiceID))                        (discover serv1)))1)))  (deregister serv1)  (<!! (timeout one-sec)))

Developing

Consul

==> Starting Consul agent...           Version: '1.8.4'           Node ID: '25c675d4-ce4a-c35b-420f-d8ff12469a5f'         Node name: 'localhost.localdomain'        Datacenter: 'dc1' (Segment: '<all>')            Server: true (Bootstrap: false)       Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600)      Cluster Addr: 127.0.0.1 (LAN: 8301, WAN: 8302)           Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false, Auto-Encrypt-TLS: false           ..............==> Consul agent running!

Self tests

Run Consul

$ consul agent -dev

Run tests

$cd /path/to/libpinkas-clj$ leintestleintest libpinkas-clj.core-testRan 3 tests containing 9 assertions.0 failures, 0 errors.

Enjoy!

License

Copyright © 2019-2020 UPDC (UPD Consutlting Ltd)

Distributed under the MIT License.


[8]ページ先頭

©2009-2025 Movatter.jp