我正在研究使用Apache Camel(使用camel-mqtt)+ Spring Boot构建AWS IoT Java客户端。这听起来像是一个很好的匹配,但无法找到任何例子。有什么缺点我无法看到吗?有兴趣看到任何指针。
答案 0 :(得分:1)
我使用以下配置。 sslContext bean包含证书/安全性:
@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());
}
};
}