Repository: camel Updated Branches: refs/heads/camel-2.18.x bf6a98529 -> 40da97091 refs/heads/master 820410e21 -> 7a511ef52
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/7a511ef5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7a511ef5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7a511ef5 Branch: refs/heads/master Commit: 7a511ef5230b7447957e27a6082a6ac5e85e2f9f Parents: 820410e Author: Chirag Anand <[email protected]> Authored: Mon Apr 24 10:43:08 2017 +0530 Committer: Claus Ibsen <[email protected]> Committed: Mon Apr 24 10:23:33 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/7a511ef5/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;
