Hi,
I’ve written an nginx module that allows the user to configure nginx
worker
processes to make detached, repeated “polling” HTTP requests. The
request
endpoint, method, URI, headers, and body are configurable, and it’s also
possible to register a set of callbacks to process the response status
line, headers, body, and finalization. The idea is that if you have a
multiple-worker setup, it may sometimes be useful to have each worker
polling some service with its own status, or to request dynamic
configuration updates, etc. In some scenarios, this may be a desirable
alternative to using shared memory to synchronize state between workers.
Module source:
Example configuration (the README has more details):
http {
poller config {
endpoint http://config;
method GET;
header Host config;
header User-Agent nginx;
uri $my_config_uri;
interval $my_config_interval;
}
}
Thanks to Piotr S. for ngx_supervisord, which showed how to build
the
detached request without an incoming connection.
-dave