Hello,

If I understand well, you want to share a SolrClient for streaming code and 
another piece of non streaming code?

I think you can have a look to the SolrClientCache class.
Instantiate a SolrClientCache once (as a Bean in your case I guess).

Then you can use it for both:

  *   getting a usual SolrClient instance (or SolrCloud by the way if someday 
you want to)
  *   passing it to the StreamContext with 
streamContext.setSolrClientCache(solrClientCache)

Gaël Jourdan-Weil
________________________________
De : sambasivarao giddaluri <sambasiva.giddal...@gmail.com>
Envoyé : mercredi 26 février 2020 02:07
À : solr-user@lucene.apache.org <solr-user@lucene.apache.org>
Objet : Re: How to use existing SolrClient with Streaming

during SolrStream initialization  i had to pass the URL again rather would
like to see if i can get it by any other way .

On Tue, Feb 25, 2020 at 5:05 PM sambasivarao giddaluri <
sambasiva.giddal...@gmail.com> wrote:

> Hi All ,
>
> I have created a SolrClient bean and checking how to use it with
> SolrStream.
>
> @Configuration(proxyBeanMethods = *false*)
> SolrConfiguration Class
>
>  @Bean
>
>     *public* SolrClient solrClient() {
>
>        String solrBaseUrl="http://***";;
>
>         *return* *new* Http2SolrClient.Builder(solrBaseUrl).build();
>
>
>
>     }
>
>
> Another Streaming  Class
>
>
> ex:
>
>  *public* List<Map<String, Object>> streamQuery(String expr) {
>
>     List<Map<String, Object>> tuples = *null*;
>
>     ModifiableSolrParams params = *new* ModifiableSolrParams();
>
>     params.set("expr", expr);
>
>     params.set("qt", "/stream");
>
>     TupleStream tupleStream = *new* SolrStream("http://***";, params)
>
>     StreamContext context = *new* StreamContext();
>
>     tupleStream.setStreamContext(context);
>
>     tuples = getTuples(tupleStream);
>
> }
>
>
> this works but is there any other way to use the existing SolrClient. I
> don't have zookeeper setup as of now
>
>
> Regards
>
> sambasiva
>
>
>
>

Reply via email to