You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gilboy <jo...@gmail.com> on 2015/04/09 23:51:08 UTC

Query re zookeeper component

Hi

When I use the zookeeper endpoint in my route to create a znode, the node
gets created but it has no data. It is the contents of the exchange in the
route which should get stored in the znode.

When I debug the code I can see the contents on the exchange but it(znode
producer) attempts to convert it to a byte array but can't find an
appropriate converter and hence null gets stored in the znode.

Would appreciate any help on this

Thanks
Joe



--
View this message in context: http://camel.465427.n5.nabble.com/Query-re-zookeeper-component-tp5765548.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Query re zookeeper component

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Thanks for spotting this. I am correcting the documentation page.



On Fri, Apr 10, 2015 at 9:36 AM, gilboy <jo...@gmail.com> wrote:
> I see now why it was not able to do the conversion. On the camel zookeeper
> documentation page: http://camel.apache.org/zookeeper.html
> <http://camel.apache.org/zookeeper.html>   it has the following example:
>
> /
> from("direct:write-to-znode").to("zookeeper://localhost:39913/somepath/somenode");
>
> Exchange e = createExchangeWithBody(testPayload);
> template.sendBodyAndHeader("direct:write-to-znode", e, "CamelZooKeeperNode",
> "/somepath/someothernode");/
>
> So when the zookeeper producer is called it attempts to convert a Camel
> Exchange to a byte array and cannot find a converter(no exception thrown).
>
> The example should be updated to something like:
> /template.sendBodyAndHeader("direct:write-to-znode", *"ZNode-Body"*,
> "CamelZooKeeperNode", "/somepath/someothernode");//
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Query-re-zookeeper-component-tp5765548p5765579.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Re: Query re zookeeper component

Posted by gilboy <jo...@gmail.com>.
I see now why it was not able to do the conversion. On the camel zookeeper
documentation page: http://camel.apache.org/zookeeper.html
<http://camel.apache.org/zookeeper.html>   it has the following example:

/
from("direct:write-to-znode").to("zookeeper://localhost:39913/somepath/somenode");

Exchange e = createExchangeWithBody(testPayload);
template.sendBodyAndHeader("direct:write-to-znode", e, "CamelZooKeeperNode",
"/somepath/someothernode");/

So when the zookeeper producer is called it attempts to convert a Camel
Exchange to a byte array and cannot find a converter(no exception thrown).

The example should be updated to something like:
/template.sendBodyAndHeader("direct:write-to-znode", *"ZNode-Body"*,
"CamelZooKeeperNode", "/somepath/someothernode");//





--
View this message in context: http://camel.465427.n5.nabble.com/Query-re-zookeeper-component-tp5765548p5765579.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Query re zookeeper component

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What Camel version and ZK version do you use?

And what kind of data type do you want to store? ZK ought only be able
to store data that can be presented as a bytes.
So maybe you need to convert the body to a compatible type, or do a
message translation first.

But it sounds like a little bug in camel-zookepper to not throw an
exception if byte[] cannot be found and instead just store null.


On Thu, Apr 9, 2015 at 11:51 PM, gilboy <jo...@gmail.com> wrote:
> Hi
>
> When I use the zookeeper endpoint in my route to create a znode, the node
> gets created but it has no data. It is the contents of the exchange in the
> route which should get stored in the znode.
>
> When I debug the code I can see the contents on the exchange but it(znode
> producer) attempts to convert it to a byte array but can't find an
> appropriate converter and hence null gets stored in the znode.
>
> Would appreciate any help on this
>
> Thanks
> Joe
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Query-re-zookeeper-component-tp5765548.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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