Hi

Ah well spotted. You are welcome to log a JIRA ticket.
http://camel.apache.org/support.html

And work on a patch to make Camel create parent nodes. Yeah the ZK api
is low level and you need to manually do a bunch to make it work.
There is a ticket to use Curator to make working with ZK pleasant. But
we are not there yet.

We love contributions and help
http://camel.apache.org/contributing

On Fri, Apr 8, 2016 at 3:52 AM, Minh Tran <darth.minhs...@gmail.com> wrote:
> I’ve investigated this further and the exception is thrown from the 
> ZooKeeper.create method. Camel is actually trying to create a znode with a 
> path /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a without 
> creating the parent node /regexTest1 first.
>
> According to the Zookeeper.create method documentation
>
> "If the parent node does not exist in the ZooKeeper, a KeeperException
>      * with error code KeeperException.NoNode will be thrown."
>
> And I don’t see anywhere in Camel’s code where it is creating the parent 
> nodes first before attempting to create the final node for master election.
>
> So I removed the path off the uri for the route policy like this
>
> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy("zookeeper:localhost", 
> 1);
>
> And it has gotten past that error but now has encountered a different error 
> where it has trouble creating a threadpool.
>
> 2016-04-08 11:47:15,071 [main] ERROR 
> org.apache.camel.component.zookeeper.policy.ZooKeeperElection - Error 
> configuring ZookeeperElection
> java.lang.IllegalArgumentException: id for thread pool 
> org.apache.camel.util.concurrent.RejectableThreadPoolExecutor@1ec912d7[Running,
>  pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 
> 0][Camel-Zookeeper Ops executor] must be specified and not empty
>         at org.apache.camel.util.ObjectHelper.notEmpty(ObjectHelper.java:351) 
> ~[camel-core-2.16.0.jar:2.16.0]
>         at 
> org.apache.camel.impl.DefaultExecutorServiceManager.onThreadPoolCreated(DefaultExecutorServiceManager.java:522)
>  ~[camel-core-2.16.0.jar:2.16.0]
>         at 
> org.apache.camel.impl.DefaultExecutorServiceManager.newThreadPool(DefaultExecutorServiceManager.java:191)
>  ~[camel-core-2.16.0.jar:2.16.0]
>         at 
> org.apache.camel.impl.DefaultExecutorServiceManager.newFixedThreadPool(DefaultExecutorServiceManager.java:230)
>  ~[camel-core-2.16.0.jar:2.16.0]
>         at 
> org.apache.camel.component.zookeeper.ZooKeeperConsumer.doStart(ZooKeeperConsumer.java:72)
>  ~[camel-zookeeper-2.16.0.jar:2.16.0]
>         at 
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
> ~[camel-core-2.16.0.jar:2.16.0]
>         at 
> org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3219)
>  ~[camel-core-2.16.0.jar:2.16.0]
>
>
>> On 7 Apr 2016, at 11:44 AM, Minh Tran <darth.minhs...@gmail.com> wrote:
>>
>> Hi
>>
>> I am trying to setup a ZooKeeper route policy like this
>>
>> ZooKeeperRoutePolicy policy = new 
>> ZooKeeperRoutePolicy("zookeeper:localhost/regexTest1?create=true", 1);
>> from("direct:start").routePolicy(policy).to(“mock:end”);
>>
>> And when I run my unit test to trigger the route, I get the following 
>> exception in my logs
>>
>> Node '/regexTest1/192.168.202.25-3306c9d2-1354-4dbe-aaff-846eee5bb60d' did 
>> not exist, creating it.
>> Error setting up election node 
>> /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a
>> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = 
>> NoNode for /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a
>>       at 
>> org.apache.zookeeper.KeeperException.create(KeeperException.java:111) 
>> ~[zookeeper-3.4.8.jar:3.4.8--1]
>>       at 
>> org.apache.zookeeper.KeeperException.create(KeeperException.java:51) 
>> ~[zookeeper-3.4.8.jar:3.4.8--1]
>>       at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783) 
>> ~[zookeeper-3.4.8.jar:3.4.8--1]
>>       at 
>> org.apache.camel.component.zookeeper.operations.CreateOperation.getResult(CreateOperation.java:52)
>>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.operations.ZooKeeperOperation.get(ZooKeeperOperation.java:70)
>>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.ZookeeperProducer.createNode(ZookeeperProducer.java:222)
>>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.ZookeeperProducer.synchronouslySetData(ZookeeperProducer.java:238)
>>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.ZookeeperProducer.process(ZookeeperProducer.java:88)
>>  ~[camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>>  ~[camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>>  [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
>>  [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:68)
>>  [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:412) 
>> [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:380) 
>> [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:270) 
>> [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:380) 
>> [camel-core-2.17.0.jar:2.17.0]
>>       at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:205) 
>> [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:119)
>>  [camel-core-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.policy.ZooKeeperElection.createCandidateNode(ZooKeeperElection.java:146)
>>  [camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.policy.ZooKeeperElection.testAndCreateCandidateNode(ZooKeeperElection.java:116)
>>  [camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.policy.ZooKeeperElection.isMaster(ZooKeeperElection.java:92)
>>  [camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.component.zookeeper.policy.ZooKeeperRoutePolicy.onExchangeBegin(ZooKeeperRoutePolicy.java:79)
>>  [camel-zookeeper-2.17.0.jar:2.17.0]
>>       at 
>> org.apache.camel.processor.CamelInternalProcessor$RoutePolicyAdvice.before(CamelInternalProcessor.java:483)
>>  [camel-core-2.17.0.jar:2.17.0]
>>
>>
>> It looks like it knows the znode doesn’t exist but seems to be unable to 
>> create it? From the zookeeper server side logs, I can see incoming 
>> connections and it returning the error that the znode doesn’t exist but 
>> doesn’t look like there’s any attempts to create it after that.
>>
>> I’ve tried using the zookeeper component directly in my route and I am able 
>> to create/write/read from a znode fine so it seems like it’s just failing in 
>> the route policy for some reason.
>>
>> I am using Camel 2.17.0 and zookeeper 3.4.8
>>
>> ps there’s an error in the Camel zookeeper documentation
>>
>> from("zookeeper://localhost:39913/somepath/somenode?awaitCreation=true").to("mock:result”);
>>
>> But there's no option called awaitCreation available on the component.
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to