roulette v1.0.4 Roulette.Config
Here is a minimum configuration example,
You must setup servers
list.
Put your load-balancers’ hostname into it.
config :my_app, MyApp.PubSub,
servers: [
"gnatsd-cluster1.example.org",
"gnatsd-cluster2.example.org"
]
Or else, you can use keyword list for each host.
config :my_app, MyApp.PubSub,
servers: [
[host: "gnatsd-cluster1.example.org", port: 4222],
[host: "gnatsd-cluster2.example.org", port: 4222]
]
If there is no port
setting, 4222 is set by defaut.
key | default | description |
---|---|---|
role | :both | You can choose :subscriber, :publisher, or :both |
servers | required | servers list used as hash-ring |
pool_size | 5 | number of connections for each gnatsd-cluster |
ping_interval | 5_000 | sends PING message to gnatsd with this interval (milliseconds) |
max_ping_failure | 2 | if PONG doesn’t return while this number of PING sends, Roulette disconnects the connection. |
max_retry | 10 | When it fails to send PUBLISH or SUBSCRIBE messages, it automatically retries until count of failure reaches to this number |
max_backoff | 5_000 | max duration(milliseconds) used to calculate backoff period |
base_backoff | 10 | base number used to calculate backoff period |
show_debug_log | false | if this is true, Roulette dumps many debug logs. |
subscription_restart | :temporary | You can choose :temporary or :permanent |
role
- :both (default) - setup both
Publisher
andSubscriber
connections - :subscriber - setup
Subscriber
connections only - :publisher - setup
Publisher
connections only
subscription_restart
:temporary
subscription-process sends EXIT message to consumer process when gnatsd-connection is disconnected.
:permanent
subscription-process try to keep subscription. when gnatsd-connection is disconnected, retry to sends SUBSCRIBE message through other connections.
Link to this section Summary
Link to this section Types
Link to this type
config_key()
config_key() :: :servers | :role | :ping_interval | :max_ping_failure | :show_debug_log | :pool_size | :max_retry | :max_backoff | :base_backoff | :subscription_restart | :nats
Link to this type
nats_config()
nats_config() :: %{:host => String.t(), :port => pos_integer(), optional(:connection_timeout) => pos_integer(), optional(:tls) => boolean(), optional(:ssl_opts) => keyword(), optional(:tcp_opts) => keyword()}
Link to this section Functions
Link to this function
get_host_and_port(target)
get_host_and_port(binary() | Keyword.t()) :: {binary(), pos_integer()}
Link to this function
merge_nats_config(module, host)
merge_nats_config(module(), host()) :: nats_config()