Simulate a "thing" in Java?


I'm hoping I can write a quick function that simulates a "thing" in Java and be able to use it to either post messages to a topic, or update its shadow.

I have the AWS Java SDK in my project and I know how to use the IotClient and IotDataPlaneClient. The problem is that these clients are both authenticated with an access key that belongs to an AWS account, and in the case of the IotDataPlane client, I have to specify the name of the thing who's shadow I want to update.

What I'd like to do instead is mimic what an actual thing would do, which is to say, use a certificate to connect with the service, and only be able to update its own shadow, etc.

It seems like this should be possible, but I can't find any kind of credentials provider that works with certificates or any other obvious way to do it.

I know there is a complicated device simulator available and I may use it months from now when my application is further along, but for right now I'm just looking for something very quick and simple to prove a few concepts and work out my strategy.

Thanks, Frank

質問済み 2年前350ビュー

Hi Frank. I'm going to mention the device SDK again. It's what a device, implemented in Java, would normally use.

Stepping outside of Java, we have similar samples in most of our other-language device SDKs. We also have the Device Client:

You can use pretty much any MQTT client though. You could even use mosquitto_pub:

profile pictureAWS
回答済み 2年前

Thanks, I have that and I think I see how it can work with certificates. I guess that when a thing updates it's "shadow" it's just posting to a queue with a reserved name, correct? Does the "thing" need to tell its own name to IoT or does IoT figure that out from its certificate?

回答済み 2年前
  • The reserved topic includes the thing name, e.g. $aws/things/THING_NAME/shadow/update

ログインしていません。 ログイン 回答を投稿する。