slacker.client.cluster
->ClusterEnabledSlackerClient
(->ClusterEnabledSlackerClient discover slacker-clients options)Positional factory function for class slacker.client.cluster.ClusterEnabledSlackerClient.
clustered-slackerc
(clustered-slackerc cluster-name zk-server & {:keys [zk-root grouping grouping-results grouping-exceptions ping-interval factory server-data-change-handler interceptors], :or {zk-root "/slacker/cluster", grouping :random, grouping-results :single, grouping-exceptions :all, ping-interval 0}, :as options})create a cluster enalbed slacker client options:
- zk-root: specify the root path in zookeeper
- factory: a client factory, default to non-ssl implementation
- grouping: specify how the client select servers to call, this allows one or more servers to be called. Possible values:
:firstalways choose the first server available:randomchoose a server by random (default):leaderuse current leader server:least-in-flightuse server with least pending requests:weightedrandomly select a server using:weightfrom server data as weight:allcall function on all servers(fn [ns fname params slacker-client servers])specify a function to choose. You can also return :random or :all in this function
- grouping-results: when you call functions on multiple server, you can specify how many results return for the call. Note that if you use :vector or :map, you will break default behavior of the function. Possible values:
:nilalways returns nil:singlereturns only one value:vectorreturns values from all servers as a vector:mapreturns values from all servers as a map, server host:port as key(fn [ns fname params])a function that returns keywords above
- grouping-exceptions: how to deal with the exceptions when calling functions on multiple instance.
:allthe API throws exception when exception is thrown on every instance:anythe API throws exception when any instance throws exception(fn [valid-result error-results])a function to decide what exception to throw or never
- server-data-change-handler: a function accepts the client object, server address and server data. Note that this function runs on event thread so never do blocking things within it.
CoordinatorAwareClient
protocol
members
delete-ns-mapping
(delete-ns-mapping this fname)get-connected-servers
(get-connected-servers this)get-ns-mappings
(get-ns-mappings this)refresh-all-servers
(refresh-all-servers this)refresh-associated-servers
(refresh-associated-servers this ns)server-data
(server-data this server-id)defn-remote
macro
(defn-remote sc fname & options)cluster enabled defn-remote, with cluster options supported.