Page 1 of 1

Client Pooling with HeadlessClient Plugin

PostPosted: Mon Jul 12, 2010 3:53 am
by sbutler
In the rest_ws plugin for restful web services, client pooling is built into the plugin. It would be nice to have this same option in the HeadlessClient plugin. I have written some code in a module to simulate pooling (simple round-robin approach) with headless clients, but real pooling can only be done in the java side of the plugin.

This is useful for some customers I have that deal a lot with third-party API's where lots of requests are sent off server-side via some API, and then when the responses are received they update the database to record the response. However, some requests can take a while to process, but you don't want to have to spawn a new headless client instance for each individual request.

Re: Client Pooling with HeadlessClient Plugin

PostPosted: Mon Jul 12, 2010 12:25 pm
by jcompagner
So we currently have the option to create a new client or to reuse an existing client.

and a JSClient instance on the server is a 1-1 with something on the server (so that you could also share and know the state on the server between calls)

But if you want you can try to create a pooling option inside the plugin by creating another createClient method where you have an extra boolean that tells the server to use a pool (of clients with a specific solution loaded)
And then the queueMethod also gives this boolean so that the server knows that it can use a randomly client that is not used yet.

Problem is that in this mode getDataProviderValue especially with an empty "currently executing function" argument doesnt make any sense..

But create a patch and we will see how it works out :)