[
https://issues.apache.org/jira/browse/CURATOR-275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14994528#comment-14994528
]
ASF GitHub Bot commented on CURATOR-275:
----------------------------------------
Github user joelittlejohn commented on the pull request:
https://github.com/apache/curator/pull/116#issuecomment-154554250
It's a very good point @serranom.
There's nothing stopping someone from doing this via the API (I don't
think) since you can simply create a new ServiceInstance (based on the field
values of the instance you want to disable) but pass `false` as the enabled
value, then use
[ServiceDiscovery#updateService(ServiceInstance)](https://github.com/joelittlejohn/curator/blob/4776a2daacb3a776e9dd0bdc214ed4987fef96c9/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscovery.java#L48)
to apply the change. This is the kind of thing a dashboard/tool (that has no
knowledge of the znode layout) could do. So in this way, all ServiceInstance
fields are always updatable via the API.
I saw this as an administrative task that (as the least worst option)
allows an update to the znode to disable an instance. I thought of this as a
useful administrative hook but not necessarily an operation that needs to part
of the core API. If we did want _improved_ support for this in the API it would
be easy to add this e.g.
`ServiceDiscovery#enable(ServiceInstance)` and
`ServiceDiscovery#disable(ServiceInstance)`
or
`ServiceInstance#enable()` and `ServiceInstance#disable()`
(followed by `ServiceDiscovery#updateService(ServiceInstance)`)
> Allow service instances to be disabled temporarily
> --------------------------------------------------
>
> Key: CURATOR-275
> URL: https://issues.apache.org/jira/browse/CURATOR-275
> Project: Apache Curator
> Issue Type: New Feature
> Components: Recipes
> Reporter: Joe Littlejohn
>
> Allow service instances to be temporarily removed from discovery (when using
> the Service Discovery recipe).
> This can be achieved with a new 'enabled' flag that is included as part of
> the service instance node data in Zookeeper. Updating this flag via e.g.
> Exhibitor will allow an instance to be disabled. When the flag is omitted,
> the service is assumed to be enabled, hence this change is backward
> compatible.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)