hazelcast-consul-discovery-spi icon indicating copy to clipboard operation
hazelcast-consul-discovery-spi copied to clipboard

Add support for configurable consul API client library plugins w/ resiliency

Open bitsofinfo opened this issue 8 years ago • 0 comments

Need to add an plugin/abstraction for what underlying consul API library we utilize.

Plugin based feature

For now create 3 interfaces for the consul APIs we currently use

CatalogAPIClient
HealthAPIClient
AgentAPIClient

The initial set of methods on each of these 3 interfaces should be compatible with the existing orbitz methods.

Create an initial orbitz consul client implementation of all 3.

<!-- Which consul API client library plugin to use -->
<property name="consul-default-client-provider">orbitz</property>

<!-- specific functional domain override -->
<property name="consul-catalog-client-provider">orbitz</property>
<property name="consul-health-client-provider">orbitz</property>
<property name="consul-agent-client-provider">orbitz</property>

Resiliancy feature

  1. Add an option that is globally obeyed to define the timeout for all API requests (both connect and socket timeouts)
<property name="consul-api-client-timeout-seconds">30</property>
  1. We need the ability to define more than one consul host/port to talk to, specifically define which consul endpoints to use for each different API we utilize, add a new configuration properties such as:
<!-- comma separated list of host:ports to use for all API clients-->
<property name="consul-hosts">localhost:port,host2:port</property>

<!-- Permit specific overrides of hosts to uses for specific APIs -->
<property name="consul-agent-hosts">localhost:port,host2:port</property>
<property name="consul-health-hosts">localhost:port,host2:port</property>
<property name="consul-catalog-hosts">localhost:port,host2:port</property>

<!-- still support this backwards compatible method, which would seed consul-hosts -->
<property name="consul-host">localhost</property>
<property name="consul-port">8500</property>

Behavior when multiple hosts are specified

Agent / Health

If more than one agent host is configured, register against each specified agent host (both register the node and a health check)

Catalog

If more than one catalog host is configured, attempt to talk to the first one, if a transient connectivity error occurs, revert to the second host and so on

bitsofinfo avatar Feb 24 '16 18:02 bitsofinfo