camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: Added the provision to pass Solr Params when pushing SolrInputDocuments.
Date Mon, 24 Apr 2017 08:24:37 GMT
Added the provision to pass Solr Params when pushing SolrInputDocuments.

This change is necessary when you intend to have an update processor chain to be trigerred
or any such for which parameters are to be passed along with the url.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/40da9709
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/40da9709
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/40da9709

Branch: refs/heads/camel-2.18.x
Commit: 40da970914a969b159a852e25b0b26aaf3f96892
Parents: bf6a985
Author: Chirag Anand <canand@gp.cv.commvault.com>
Authored: Mon Apr 24 10:43:08 2017 +0530
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Apr 24 10:24:26 2017 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/solr/SolrProducer.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/40da9709/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
index 0052b7d..2a662d6 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
@@ -137,6 +137,13 @@ public class SolrProducer extends DefaultProducer {
                 UpdateRequest updateRequest = new UpdateRequest(getRequestHandler());
                 updateRequest.add((SolrInputDocument) body);
 
+                for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet())
{
+                    if (entry.getKey().startsWith(SolrConstants.PARAM)) {
+                        String paramName = entry.getKey().substring(SolrConstants.PARAM.length());
+                        updateRequest.setParam(paramName, entry.getValue().toString());
+                    }
+                }
+
                 updateRequest.process(solrServer);
 
             } else if (body instanceof List<?>) {
@@ -146,6 +153,13 @@ public class SolrProducer extends DefaultProducer {
                     UpdateRequest updateRequest = new UpdateRequest(getRequestHandler());
                     updateRequest.add((List<SolrInputDocument>) list);
 
+                    for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet())
{
+                        if (entry.getKey().startsWith(SolrConstants.PARAM)) {
+                            String paramName = entry.getKey().substring(SolrConstants.PARAM.length());
+                            updateRequest.setParam(paramName, entry.getValue().toString());
+                        }
+                    }
+
                     updateRequest.process(solrServer);
                 } else {
                     invalid = true;


Mime
View raw message