camel-elasticsearch component starts up an instance even though IP specified

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

camel-elasticsearch component starts up an instance even though IP specified

nocturnal3d
Hi guys,

I'm using camel 2.13 with the ElasticSearch component (camel-elasticsearch-2.13).

I specify the endpoint as such:

elasticsearch://clusterName?operation=INDEX&indexName=indexname&indexType=doctype&ip=127.0.0.1

I would have assumed that by specifying the IP address of the ES instance that the component would not spool up it's own local instance - but, it does.

I have looked at the source code and made the following changes in ElasticsearchEndpoint.java (which seem to work - i.e. component won't spool up an ES instance if an IP is provided):

FROM:
@Override
    protected void doStart() throws Exception {
        super.doStart();
        if (config.isLocal()) {
            LOG.info("Starting local ElasticSearch server");
        } else {
            LOG.info("Joining ElasticSearch cluster " + config.getClusterName());
        }
        node = config.buildNode();
        if (config.getIp() != null && !config.isLocal()) {
            Settings settings = ImmutableSettings.settingsBuilder()
                    .put("cluster.name", config.getClusterName()).put("node.client", true).build();
            Client client = new TransportClient(settings)
                    .addTransportAddress(new InetSocketTransportAddress(config.getIp(), config.getPort()));
            this.client = client;
        } else {
            client = node.client();
        }
    }

TO:

 @Override
    protected void doStart() throws Exception {
        super.doStart();
        if (config.isLocal()) {
            LOG.info("Starting local ElasticSearch server");
        } else {
            LOG.info("*** Joining ElasticSearch cluster " + config.getClusterName());
        }

        if (config.getIp() != null) {
            LOG.info("*** REMOTE ELASTICSEARCH: {}", config.getIp());

            Settings settings = ImmutableSettings.settingsBuilder()
                    .put("cluster.name", config.getClusterName())
                    .put("client.transport.ignore_cluster_name", false)
                    .put("node.client", true)
                    .put("client.transport.sniff", true)
                    .build();
            Client client = new TransportClient(settings)
                    .addTransportAddress(new InetSocketTransportAddress(config.getIp(), config.getPort()));
            this.client = client;
        } else {
            this.node = config.buildNode();
            this.client = node.client();
        }
    }

This seems to work. Is this a valid bug? or was the intention to spool up the ES instance no matter what is specified?

thanks in advance. Jose.
Reply | Threaded
Open this post in threaded view
|

Re: camel-elasticsearch component starts up an instance even though IP specified

ceposta
Open a JIRA and submit your patch.


On Mon, Jun 2, 2014 at 8:25 AM, nocturnal3d <[hidden email]> wrote:

> Hi guys,
>
> I'm using camel 2.13 with the ElasticSearch component
> (camel-elasticsearch-2.13).
>
> I specify the endpoint as such:
>
>
> *elasticsearch://clusterName?operation=INDEX&indexName=indexname&indexType=doctype&ip=127.0.0.1*
>
> I would have assumed that by specifying the IP address of the ES instance
> that the component would not spool up it's own local instance - but, it
> does.
>
> I have looked at the source code and made the following changes in
> ElasticsearchEndpoint.java (which seem to work - i.e. component won't spool
> up an ES instance if an IP is provided):
>
> FROM:
>
>
> TO:
>
>
>
> This seems to work. Is this a valid bug? or was the intention to spool up
> the ES instance no matter what is specified?
>
> thanks in advance. Jose.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-elasticsearch-component-starts-up-an-instance-even-though-IP-specified-tp5751825.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Reply | Threaded
Open this post in threaded view
|

Re: camel-elasticsearch component starts up an instance even though IP specified

Claus Ibsen-2
Hi

I logged a ticket to not forget about it
https://issues.apache.org/jira/browse/CAMEL-7502

Jose, you are welcome to work on patch to submit
http://camel.apache.org/contributing.html

On Wed, Jun 4, 2014 at 3:42 AM, Christian Posta
<[hidden email]> wrote:

> Open a JIRA and submit your patch.
>
>
> On Mon, Jun 2, 2014 at 8:25 AM, nocturnal3d <[hidden email]> wrote:
>
>> Hi guys,
>>
>> I'm using camel 2.13 with the ElasticSearch component
>> (camel-elasticsearch-2.13).
>>
>> I specify the endpoint as such:
>>
>>
>> *elasticsearch://clusterName?operation=INDEX&indexName=indexname&indexType=doctype&ip=127.0.0.1*
>>
>> I would have assumed that by specifying the IP address of the ES instance
>> that the component would not spool up it's own local instance - but, it
>> does.
>>
>> I have looked at the source code and made the following changes in
>> ElasticsearchEndpoint.java (which seem to work - i.e. component won't spool
>> up an ES instance if an IP is provided):
>>
>> FROM:
>>
>>
>> TO:
>>
>>
>>
>> This seems to work. Is this a valid bug? or was the intention to spool up
>> the ES instance no matter what is specified?
>>
>> thanks in advance. Jose.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/camel-elasticsearch-component-starts-up-an-instance-even-though-IP-specified-tp5751825.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/