[Azure IoT Edge]How can I to get the moduleid in my container app by java SDK?

罗宇恒 罗宇恒 571 Reputation points
2021-05-17T11:05:59.31+00:00

I am implementing a IoT Edge App, and I want to get the moduleid in my container app by java SDK.
But I dont know how.

Is there any API or sample code?

Thanks.

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
574 questions
{count} votes

Accepted answer
  1. 罗宇恒 罗宇恒 571 Reputation points
    2021-05-18T07:40:36.147+00:00

    I find the solution now, we can use following code to get ModuleId without set the Environment env value in the deployment.template.json.

    ModuleClient client = ModuleClient.createFromEnvironment(protocol);
    String moduleId = client.getConfig().getModuleId();
    System.out.println("moduleId: " + moduleId);

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.