Hi,

The problem was that the MQTT messages are treated by ActiveMQ as ByteArray
messages and Webservices expect string messages.

To solve the problem I use the following camel.xml.

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
        <route>
            <description>Example Camel Route</description>
            <from uri="broker:topic:test"/>

            <transform>
                <simple>${bodyAs(String)}</simple>
            </transform>

            <to   uri="activemq:topic:output"/>
        </route>
</camelContext>

Regards,


-- 

*Daniel Oliveira Nascimento *


2015-09-04 17:34 GMT-03:00 Daniel Oliveira Nascimento <
daniel.nascime...@devexmining.com>:

> Hi,
>
> I'm starting using the routing capabilities of ActiveMQ and I wish to
> connect some sensors connected using MQTT to a web application polling a
> REST webservice.
>
> Following the ActiveMQ example using the first scenario commands
> everything works fine, and a get the message printed in console. But when I
> try, the second scenario commands, anything is printed.
>
> Anybody could tell me what is missing in the second scenario?
>
> 1) Scenario
> # Producer
> curl -XPOST -d "body=message" "http://admin:admin@localhost
> :8161/api/message?destination=topic://test&clientId=producer"
>
> # Consumer
> curl -XGET "http://admin:admin@localhost
> :8161/api/message?destination=topic://test&clientId=consumer"
>
> 2)
> # Producer
> mosquitto_pub  -i producer2 -u admin -P admin -m "body=message" -t test
>
> # Consumer
> curl -XGET "http://admin:admin@localhost
> :8161/api/message?destination=topic://test&clientId=consumer"
>
>
> Thanks,
> --
>
> *Daniel Oliveira Nascimento *
>
>

Reply via email to