Nginx module example with callback
agentzh
agentzh at gmail.com
Wed Jun 13 15:06:31 UTC 2012
Hello!
On Wed, Jun 13, 2012 at 7:34 PM, vivek goel <goelvivek2011 at gmail.com> wrote:
> I am using a non-blocking library which reads from file-system and calls a
> callback when event has accrued. I want to integrate it with nginx module.
> From where I can find an example where I can send response from third party
> library callback?
>
The key here is to let nginx monitor the events for your library here
because there has to be one single event loop in the nginx worker
process. So your library cannot take the control and run its own event
loop because it will certainly block the nginx worker.
You can take a look at the ngx_drizzle and ngx_postgres modules:
http://wiki.nginx.org/HttpDrizzleModule
https://github.com/FRiCKLE/ngx_postgres
Both of them integrate nonblocking libraries (libdrizzle and libpq)
into the nginx event model. And for ngx_drizzle, it bypasses the
"poll" calls in libdrizzle to prevent conflicts.
Best regards,
-agentzh
More information about the nginx-devel
mailing list