Unless you want to just write a RESTful API, you want
send/suspend/dispatch and you can make any kind of response you want.
The documentation uses response/xexpr but you could put the URL
anywhere you'd like, including sending it in an email or through
carrier pigeon.

Jay

On Sat, Apr 18, 2015 at 4:08 PM, George Neuner <gneun...@comcast.net> wrote:
> Hi Jay,
>
> WRT the database, I was just describing the situation in case anyone had a
> better idea than mine.
>
> For my own solution I think the basic question I need answered is how to
> generate URLs for 2 differently parameterized calls of the same function.  I
> would have 2 distinct continuations - next and prev - which would both be
> the same function but with different arguments.  I see something similar
> being done in the Add/Subtract example for  send/suspend/dispatch, but that
> example uses HTML and I need to send the URLs via JSON.  Is embed/url  still
> the right function to use?   And is there a difference between send/suspend
> and send/suspend/dispatch when there are multiple continuations?
>
> George
>
>
>
> On 4/18/2015 3:07 PM, Jay McCarthy wrote:
>>
>> Hi George,
>>
>> The database question is independent of the continuation question and
>> I'm not sure how to help you solve that problem. However, it sounds
>> like you are asking if continuations can capture state like "display
>> sublist 2" or "display sublist 3". They definitely can. Any of the
>> continuation capturing functions (s/s or s/s/d) will work.
>>
>> As for cleanup, eventually the continuation's memory will be freed.
>> The default policy is discussed here:
>>
>>
>> http://docs.racket-lang.org/web-server/servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29
>>
>> Jay
>>
>> On Sat, Apr 18, 2015 at 12:34 PM, George Neuner <gneun...@comcast.net>
>> wrote:
>> > Hi all,
>> >
>> > I have an web server application in which I need to page results of a
>> > database query, but I also have to guarantee *exactly-once* statistical
>> > processing of each sent result row regardless of how many times it may
>> > be
>> > sent.
>> >
>> > The results are from a complex join, however the join is separable into
>> > one
>> > that gets a list of ids and then another that uses the ids to get the
>> > actual
>> > return data.  Since the ids are separable (and small), my first thought
>> > was
>> > to gather the list of ids and then to page through the list separately
>> > retrieving the associated data and doing statistical processing on the
>> > rows
>> > as necessary.
>> >
>> > However, to do this, I have to keep the initial id list across multiple
>> > requests and that is where I've run into trouble.  Thus far, I haven't
>> > had
>> > to use web server continuations.  It seems like send/suspend does not
>> > allow
>> > the browser to provide additional arguments (like paging direction).
>> > send/suspend/dispatch looks like it will do what I want, however I need
>> > to
>> > communicate the URLs to the browser in JSON and it (superficially)
>> > appears
>> > as if  embed/url is meant to work in generated HTML?
>> >
>> > The final problem is how to ensure that I eventually get to send/finish
>> > and
>> > clean up my thread.  This particular function is expected to be executed
>> > quite often.  Does the browser app have to invoke a URL that
>> > deliberately
>> > ends the thread or will the thread end if/when its continuations time
>> > out?
>> >
>> > Apologies if this is rambling - I'm trying to sort out a bunch of things
>> > all
>> > at once.
>> > Thanks,
>> > George
>
>



-- 
Jay McCarthy
http://jeapostrophe.github.io

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to