You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/11/09 07:57:47 UTC

[camel] branch master updated (d4c06e3 -> ac99f2a)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from d4c06e3  CAMEL-12912 - Action Request Converter is reseting ID on index request to header that is not set
     new 409c876  CAMEL-12924 - Camel-Elasticsearch-rest: Use not deprecated methods after the client upgrade
     new 9e74ea0  Camel-Elastisearch-rest: the restHighLevelClient must be closed when disconnecting
     new ac99f2a  Camel-Elasticsearch-rest: Fixed CS

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../elasticsearch/ElasticsearchProducer.java       | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)


[camel] 01/03: CAMEL-12924 - Camel-Elasticsearch-rest: Use not deprecated methods after the client upgrade

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 409c876188a4f899164afe59d795c02789158094
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Nov 9 08:33:58 2018 +0100

    CAMEL-12924 - Camel-Elasticsearch-rest: Use not deprecated methods after the client upgrade
---
 .../elasticsearch/ElasticsearchProducer.java       | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
index 06072e5..7822cbe 100644
--- a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
+++ b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
@@ -38,6 +38,7 @@ import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.search.MultiSearchRequest;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.update.UpdateRequest;
+import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestClient;
 import org.elasticsearch.client.RestClientBuilder;
 import org.elasticsearch.client.RestHighLevelClient;
@@ -155,22 +156,22 @@ public class ElasticsearchProducer extends DefaultProducer {
 
         if (operation == ElasticsearchOperation.Index) {
             IndexRequest indexRequest = message.getBody(IndexRequest.class);
-            message.setBody(restHighLevelClient.index(indexRequest).getId());
+            message.setBody(restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT).getId());
         } else if (operation == ElasticsearchOperation.Update) {
             UpdateRequest updateRequest = message.getBody(UpdateRequest.class);
-            message.setBody(restHighLevelClient.update(updateRequest).getId());
+            message.setBody(restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT).getId());
         } else if (operation == ElasticsearchOperation.GetById) {
             GetRequest getRequest = message.getBody(GetRequest.class);
-            message.setBody(restHighLevelClient.get(getRequest));
+            message.setBody(restHighLevelClient.get(getRequest, RequestOptions.DEFAULT));
         } else if (operation == ElasticsearchOperation.Bulk) {
             BulkRequest bulkRequest = message.getBody(BulkRequest.class);
-            message.setBody(restHighLevelClient.bulk(bulkRequest).getItems());
+            message.setBody(restHighLevelClient.bulk(bulkRequest, RequestOptions.DEFAULT).getItems());
         } else if (operation == ElasticsearchOperation.BulkIndex) {
             BulkRequest bulkRequest = message.getBody(BulkRequest.class);
-            message.setBody(restHighLevelClient.bulk(bulkRequest).getItems());
+            message.setBody(restHighLevelClient.bulk(bulkRequest, RequestOptions.DEFAULT).getItems());
         } else if (operation == ElasticsearchOperation.Delete) {
             DeleteRequest deleteRequest = message.getBody(DeleteRequest.class);
-            message.setBody(restHighLevelClient.delete(deleteRequest).getResult());
+            message.setBody(restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT).getResult());
         } else if (operation == ElasticsearchOperation.DeleteIndex) {
             DeleteRequest deleteRequest = message.getBody(DeleteRequest.class);
             message.setBody(client.performRequest("Delete", deleteRequest.index()).getStatusLine().getStatusCode());
@@ -182,7 +183,7 @@ public class ElasticsearchProducer extends DefaultProducer {
             SearchRequest searchRequest = new SearchRequest(exchange.getIn().getHeader(ElasticsearchConstants.PARAM_INDEX_NAME, String.class));
             searchRequest.source(sourceBuilder);
             try {
-                restHighLevelClient.search(searchRequest);
+                restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
                 message.setBody(true);
             } catch (ElasticsearchStatusException e) {
                 if (e.status().equals(RestStatus.NOT_FOUND)) {
@@ -194,14 +195,14 @@ public class ElasticsearchProducer extends DefaultProducer {
             }
         } else if (operation == ElasticsearchOperation.Search) {
             SearchRequest searchRequest = message.getBody(SearchRequest.class);
-            message.setBody(restHighLevelClient.search(searchRequest).getHits());
+            message.setBody(restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT).getHits());
         } else if (operation == ElasticsearchOperation.MultiSearch) {
             MultiSearchRequest searchRequest = message.getBody(MultiSearchRequest.class);
-            message.setBody(restHighLevelClient.multiSearch(searchRequest).getResponses());
+            message.setBody(restHighLevelClient.msearch(searchRequest, RequestOptions.DEFAULT).getResponses());
         } else if (operation == ElasticsearchOperation.Ping) {
-            message.setBody(restHighLevelClient.ping());
+            message.setBody(restHighLevelClient.ping(RequestOptions.DEFAULT));
         } else if (operation == ElasticsearchOperation.Info) {
-            message.setBody(restHighLevelClient.info());
+            message.setBody(restHighLevelClient.info(RequestOptions.DEFAULT));
         } else {
             throw new IllegalArgumentException(ElasticsearchConstants.PARAM_OPERATION + " value '" + operation + "' is not supported");
         }


[camel] 02/03: Camel-Elastisearch-rest: the restHighLevelClient must be closed when disconnecting

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9e74ea0eed542dc20a13097cd18114afbcbefff7
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Nov 9 08:53:15 2018 +0100

    Camel-Elastisearch-rest: the restHighLevelClient must be closed when disconnecting
---
 .../org/apache/camel/component/elasticsearch/ElasticsearchProducer.java  | 1 +
 1 file changed, 1 insertion(+)

diff --git a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
index 7822cbe..314b4c2 100644
--- a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
+++ b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
@@ -227,6 +227,7 @@ public class ElasticsearchProducer extends DefaultProducer {
         }
         if (configuration.getDisconnect()) {
             IOHelper.close(client);
+        	IOHelper.close(restHighLevelClient);
             client = null;
             if (configuration.getEnableSniffer()) {
                 IOHelper.close(sniffer);


[camel] 03/03: Camel-Elasticsearch-rest: Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ac99f2a9ce8c230f3c0080914452b58320f36683
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Nov 9 08:56:41 2018 +0100

    Camel-Elasticsearch-rest: Fixed CS
---
 .../org/apache/camel/component/elasticsearch/ElasticsearchProducer.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
index 314b4c2..f3fee32 100644
--- a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
+++ b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java
@@ -227,7 +227,7 @@ public class ElasticsearchProducer extends DefaultProducer {
         }
         if (configuration.getDisconnect()) {
             IOHelper.close(client);
-        	IOHelper.close(restHighLevelClient);
+            IOHelper.close(restHighLevelClient);
             client = null;
             if (configuration.getEnableSniffer()) {
                 IOHelper.close(sniffer);