Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: HTTP Endpoint for WatchHandler #3305

Closed
HadarGreinsmark opened this issue Jul 20, 2017 · 5 comments
Closed

Feature request: HTTP Endpoint for WatchHandler #3305

HadarGreinsmark opened this issue Jul 20, 2017 · 5 comments
Milestone

Comments

@HadarGreinsmark
Copy link
Contributor

Currently when a new watch is triggered, you can specify a handler that execute an executable
when changes are made. The executable get the trigger message through a JSON object on stdin. It would be nice to have an additional handler that specify an HTTP endpoint, similar to health checks.

As for an example configuration like this:

{
  "type": "key",
  "key": "foo/bar/baz",
  "http": "https://localhost:5000/watch",
}

the WatchHandler would send this when triggered:

POST /watch HTTP/1.1
Host: localhost:5000
Content-Type: application/json
Content-Length: 140
X-Consul-Index: 123

{
  "Key": "foo/bar/baz",
  "CreateIndex": 1793,
  "ModifyIndex": 1793,
  "LockIndex": 0,
  "Flags": 0,
  "Value": "aGV5",
  "Session": ""
}

The connection could keep-alive for a long time, if the server is agreeing on it.

Inspiration: https://developers.google.com/drive/v3/web/push
I would be willing to implement this.

@HadarGreinsmark
Copy link
Contributor Author

@slackpad

@preetapan
Copy link
Contributor

preetapan commented Aug 9, 2017

@HadarGreinsmark we talked about this internally, and this is a good addition to consul. Thanks for volunteering to implement this.

One suggestion as you start work on this - We would like the endpoint's behavior be configurable. For example don't support just POST but allow the http method to be configurable. Take a look at https://www.consul.io/docs/agent/options.html#http_config with its sub keys for a canonical example on how to set up configuration. For this feature, we could make the url, method, headers, and keep-alive time configurable to start, and that gives us a starting point to add more options if use cases demand it in the future.

Let us know if you have other questions, looking forward to seeing this get in.

@HadarGreinsmark
Copy link
Contributor Author

Good to hear that! I'll start to implement this in the end of next week.

@p1nkrock
Copy link

p1nkrock commented Oct 3, 2017

@HadarGreinsmark Is the implementation done for HTTP Watch Endpoint?

@HadarGreinsmark
Copy link
Contributor Author

Yes @p1nkrock , it is sort of done as I see it. The pull request just has to be reviewed and merged.

@preetapan preetapan added this to the 1.0.1 milestone Oct 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants