Read MQTT topic of received message in Camel Route -


i trying configure apache camel spring route. consume messages mqtt , print them topic. how topic message published to?

i'm using apache camel 2.16.1
camel-context.xml

<beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"        xsi:schemalocation="        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">      <camelcontext xmlns="http://camel.apache.org/schema/spring" id="mqttcamel">         <route>             <from uri="mqtt:iot?host=tcp://iot.eclipse.org:1883&amp;subscribetopicnames=#" />             <convertbodyto type="java.lang.string" />             <to uri="stream:out" />         </route>     </camelcontext>  </beans> 

with mqtt component, topic stored in header called "camelmqttsubscribetopic":

from("mqtt:foo?subscribetopicname=#&host=tcp://127.0.0.1:1883")    .log("message read topic ${in.header.camelmqttsubscribetopic}."); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -