Generally, you shouldn't be trying to maintain, let alone share "state" in Solr itself. It sounds like you need an application layer between your application clients and Solr which could then maintain whatever state it needs.

-- Jack Krupansky

-----Original Message----- From: Peyman Faratin
Sent: Saturday, August 17, 2013 12:29 PM
To: solr-user@lucene.apache.org
Subject: State sharing

Hi

I have subclassed a SearchComponent (call this class S), and would like to implement the following transaction logic:

1- Client K calls the S's handler

2- S spawns a thread and immediately acks K using rb.rsp.add("status","complete") then terminates

public void process (ResponseBuilder rb)
{
SolrParams params = rb.req.getParams();

try{
ExecutorService executorService = Executors.newCachedThreadPool();

Processor job = new  Processor(rb);

executorService.submit(job);
rb.rsp.add("status","complete");

}catch(Exception e) {e.printStackTrace();};
}

3- The thread S started ("job" above) does two chunks of logic in serial (call these B and C):

i) B does some processing and sends client K a series of status updates, then ii) C does some processing and in turn sends K series of status updates then one final complete message
iii)  transaction ends

I am using SOLR 4.3.1. How can I support such a transaction in solr? I've tried sharing S's ResponseBuilder with the thread but presumably because S terminates in step 2 K will never see the response from B and C. In general I would like to implement a mechanism that can share processing state with the client in the same http session.

thank you for your help

Peyman


Reply via email to