Query re zookeeper component

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

Query re zookeeper component

gilboy
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
Reply | Threaded
Open this post in threaded view
|

Re: Query re zookeeper component

Claus Ibsen-2
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 <[hidden email]> 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: [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/
Reply | Threaded
Open this post in threaded view
|

Re: Query re zookeeper component

gilboy
I see now why it was not able to do the conversion. On the camel zookeeper documentation page: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");

Reply | Threaded
Open this post in threaded view
|

Re: Query re zookeeper component

Claus Ibsen-2
Hi

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



On Fri, Apr 10, 2015 at 9:36 AM, gilboy <[hidden email]> 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: [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/