You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Steve973 <st...@gmail.com> on 2023/04/08 22:45:32 UTC

Camel Pulsar

Hello.  I am trying to use Pulsar, and the documentation is not super
thorough.  I have set up a server, and my camel app can connect to it.
But, when I try to send a message through it, when I receive it, I cannot
decode it!  I have tried just letting it serialize the pojo, and then
deserialize it when receiving.  That did not work, so I attempted to
convert it to a json string, and then convert it back to a string on
receipt, and then use unmarshal().json().  I searched for camel pulsar
examples, but I haven't found much.  Can anyone point me in the right
direction, please?

Here is what my attempt looks like:

I am running pulsar in a container in standalone mode.

Sending:
ControlMessage message = createSubscribeMessage();
String json = mapper.writeValueAsString(message);
producerTemplate.sendBody(subscribeUri, json);

Receiving:
from(mainRouterConfig.controlEntrypoint())
.convertBodyTo(String.class)
.unmarshal().json(ControlMessage.class)
.process(exchange -> Optional.ofNullable
(exchange.getIn().getBody(ControlMessage.class))

I can either use, or omit, the .convertBodyTo(String.class) part, and the
result is the same:
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('¬'
(code 172)): expected a valid value (JSON String, Number, Array, Object or
token 'null', 'true' or 'false')

Any ideas?

Thanks,
Steve