[
https://issues.apache.org/jira/browse/CAMEL-12512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16475794#comment-16475794
]
Viachaslau Tsikhanovich commented on CAMEL-12512:
-------------------------------------------------
I am afraid there can be an issue with [this
flow|https://github.com/apache/camel/commit/0c65887e936fa87f7f3d27a1db0d90264d581df7#diff-f50e64195331350b7ea551c33b37a2bcR105]
There can be a case when Consul client is not provided through
parameters/configuration, so at first
{color:#6f42c1}getConsul{color}{color:#24292e}(){color} call it will be created
(i.e.
{color:#24292e}configuration{color}{color:#d73a49}.{color}{color:#24292e}createConsulClient(getCamelContext()){color}
will be called which does not set created Consul client into configuration).
Then on next {color:#6f42c1}getConsul{color}{color:#24292e}(){color} call
_consul_ field is not _null_ so according to the flow it will be reset from
configuration which stores null (consul =
getConfiguration().getConsulClient()). Thus it will return null and cause NPE
for example during [watcher creation on route
restart|https://github.com/apache/camel/blob/master/components/camel-consul/src/main/java/org/apache/camel/component/consul/endpoint/AbstractConsulConsumer.java#L55]
> camel-consul - Option to inject Consul client
> ---------------------------------------------
>
> Key: CAMEL-12512
> URL: https://issues.apache.org/jira/browse/CAMEL-12512
> Project: Camel
> Issue Type: Wish
> Components: camel-consul
> Affects Versions: 2.21.1
> Reporter: Viachaslau Tsikhanovich
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 2.22.0
>
>
> It would be great to have an option to pass Consul client bean as a
> configuration parameter in a way similar as it is done for _amazonSQSClient_
> in camel-aws component (i.e.
> ["amazonSQSClient=#client"|http://camel.apache.org/aws-sqs.html]). So it
> could be "consulClient=#consul" for example.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)