Apache Camel: First IOTA Component Example


I am proud to comunicate that Apache Camel since version 2.24 will support IOTA DLT Component (I'm the author)

Apache Camel is a open source implementation of famous Enterprise Integration Patterns. Camel is a Routing and Mediation Engine and facilitates the developers to create routes and mediation rules in variety of Domain Specific language(DSL) such as java, Spring/XML, Scala etc.


Into this blog article i will explain how to create a simple project to send data from MQTT to IOTA Tangle!

Create java project

To create java project you can use maven archetypes

mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes \
  -DarchetypeArtifactId=camel-archetype-spring -DarchetypeVersion=2.22.0 \

Inside the folder src/main/resources/META-INF/spring can find the main file camel-context.xml

POM dependencies



Note: You must upgrade camel version form 2.22.0 to 2.24.0-SNAPSHOT

Write the code

Now is let time to edit the file to write data to the tangle

    <from uri="mqtt://test?host=tcp://test.mosquitto.org:1883&amp;subscribeTopicName=fabryprog-iota/test"/>
    <setHeader headerName="CamelIOTASeed">
    <setHeader headerName="CamelIOTAValue">
    <setHeader headerName="CamelIOTAToAddress">
    <to uri="iota://fabryprog-iota?url=https://nodes.thetangle.org:443&amp;tag=APACHECAMELIOTA&amp;operation=sendTransfer&amp;depth=3" />

Now, open terminal and launch the command to camel run

 mvn clean camel:run

(terminal output)

Send MQTT data

You can send data to mqtt server using a common mqtt client

I use mosquitto-client:

 mosquitto_pub -h test.mosquitto.org -t fabryprog-iota/test -m "First Apache Camel Iota Example"

Now you can find my transaction test using tangle explorer (link)

Have fun with Apache Camel IOTA!

GitHub Repo

Apache Camel Official Documentation


Post popolari in questo blog

Hadoop, how to create a single node cluster using docker

Apache Spark - Try it using docker!

How to install IOTA node with docker