简体   繁体   中英

Subscribing to an AWS IoT topic in a Java backend

When using the AWS Java SDK ( aws-java-sdk-iot ) it is possible to publish messages to an AWS IoT topic from a backend system, but it doesn't seem possible to subscribe to a topic? What is the reasoning behind this?

We are looking for a way to have our Java backend (deployed on AWS) take part in our IoT solution and being able to publish and subscribe to topics. If using the sdk is not the way to go, what would be a good design to achieve this?

We do not want to use the AWS Device SDK for this.

The non-device SDKs for IoT are request/response oriented and use the HTTP protocol. It would be a weird API (see the SQS API) if it held open an HTTP request until a message arrived on a subscription.

The AWS Device SDK is not a bad choice, but you could avoid using it by doing the same thing it does and set up a persistent connection to the broker using MQTT or MQTT + WebSocket.

If you decide to roll your own MQTT client, using Netty and its MQTT codec would be a reasonable place to start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM