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회 조회
2개 답변

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

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠