in docker_images/java/wrapper/src/main/java/glue/ModuleGlue.java [565:591]
public void getTwin(String connectionId, Handler<AsyncResult<Twin>> handler)
{
System.out.printf("getTwin with %s%n", connectionId);
ModuleClient client = getClient(connectionId);
if (client == null)
{
handler.handle(Future.failedFuture(new MainApiException(500, "invalid connection id")));
}
else
{
this.setTwinHandler(handler);
try
{
com.microsoft.azure.sdk.iot.device.twin.Twin twin = client.getTwin();
TwinCollection desiredProperties = twin.getDesiredProperties();
for (String key : desiredProperties.keySet())
{
onPropertyChanged(new Property(key, desiredProperties.get(key)), null);
}
} catch (Exception e)
{
this.setTwinHandler(null);
handler.handle(Future.failedFuture(e));
}
}
}