| From | Sent On | Attachments |
|---|---|---|
| Magnus Lynch | Apr 25, 2010 1:57 am | |
| agentzh | Apr 25, 2010 2:35 am | |
| zhicheng | Apr 25, 2010 3:28 am | |
| agentzh | Apr 25, 2010 3:43 am | |
| agentzh | Apr 25, 2010 3:43 am | |
| zhicheng | Apr 25, 2010 8:35 am | |
| Magnus Lynch | Apr 26, 2010 3:32 am | |
| agentzh | Apr 26, 2010 4:42 am | |
| agentzh | May 4, 2010 7:11 pm |
| Subject: | Re: Communications Sequence with Upstream | |
|---|---|---|
| From: | Magnus Lynch (mag...@gmail.com) | |
| Date: | Apr 26, 2010 3:32:51 am | |
| List: | ru.sysoev.nginx | |
On Sun, Apr 25, 2010 at 2:35 AM, agentzh <agen...@gmail.com> wrote:
On Sun, Apr 25, 2010 at 4:58 PM, Magnus Lynch <mag...@gmail.com> wrote:
Say I have a location /url that I want to construct responses to based on a sequence of communications with an upstream, host:port. To be specific, the upstream would be a database, and the sequence of communications would comprise commands and responses.
We've been doing this kind of things via ngx_echo's echo_location directive in our ngx_memc and ngx_drizzle's tests suite. Here's some an example to do sequential memcached command execution against the ngx_memc upstream module in a single location /main:
location /main { echo_location '/memc?cmd=flush_all'; echo_location '/memc?key=foo&cmd=set&val='; echo_location '/memc?key=foo&cmd=get'; } location /memc { set $memc_cmd $arg_cmd; set $memc_key $arg_key; set $memc_value $arg_val; memc_pass 127.0.0.1:11211; }
You can find more examples here: http://github.com/agentzh/memc-nginx-module/blob/master/test/t/
Thanks. I looked over echo_location. It uses ngx_http_subrequest, which I had gathered to be limited to concatenating responses together, and it still appears that way to me. It appears there's no hook for you to deal with the data the subrequest produces, as the various filter hooks the upstream support provides.
This the flow it appears to me you're limited to: handler does HTTP GET x_1, response y_1 comes back, ..., HTTP GET x_n, response y_n. and what message the handler ultimately produces is y_1...y_n.
I'm interested in a more general ability to: handler sends arbitrary message x_1, response y_1 comes back, ... repeat n times. handler sends response f(y_1, ..., y_n) to original query, f an arbitrary function--which is to say I want to have the responses passed through a filter of mine as they're generated, not sent straight to the client.
Maybe I'll have to write my own code from scratch for dealing with this.
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx





