0

I am looking into building a AWS IoT Java Client with Apache Camel ( using camel-mqtt ) + Spring Boot. It sounds like a good match to me, but couldn't find any examples. Is there any drawback that I can't see ? Would be interested to see any pointers.

UCJava
  • 307
  • 4
  • 19
  • You may also look at using camel-paho as Eclipse Paho is a bit more maintained project than the MQTT client that camel-mqtt uses. For examples you can look at the IoT bloggers. Some have shown how to do this with Camel, MQTT and IoT devices. – Claus Ibsen Aug 04 '17 at 12:16
  • Thanks @ClausIbsen ! , do you know any good example camel-paho used to connect to AWS IoT ? I couldn't seem find any solid example. – UCJava Aug 07 '17 at 17:03

1 Answers1

1

I got it working with the below configuration. sslContext bean holds the certificate/security :

    @Bean
    RouteBuilder awsIoTRoute() {

        return new RouteBuilder() {

            @Override
            public void configure() throws Exception {

                from("timer://foo?repeatCount=0&delay=5000&fixedRate=true&period=17s")
                    .setBody(simple("TEST MESSAGE"))
                    .to("mqtt:awsIoTPublisher?host=ssl://{{aws.iot.host}}:8883&publishTopicName={{aws.iot.pub.topic}}&clientId={{aws.iot.pub.clientId}}&sslContext=#sslContext")
                    .log("Sent :"+body().convertToString().toString());

                from("mqtt:awsIoTReciever?host=ssl://{{aws.iot.host}}:8883&subscribeTopicName={{aws.iot.sub.topic}}&clientId={{aws.iot.sub.clientId}}&sslContext=#sslContext").log("Recieved : "+body().convertToString());


            }
        };
    }
UCJava
  • 307
  • 4
  • 19