Azure / azure-libraries-for-java

Azure Management Libraries for Java
https://docs.microsoft.com/en-us/java/azure/
MIT License
94 stars 97 forks source link

Azure VirtualMachine runShellScriptAsync function is not working... #1400

Closed cjhoon1014 closed 3 years ago

cjhoon1014 commented 3 years ago

Query/Question I'm using Azure JAVA SDK. I try to Azure VirtualMacine runShellScriptAsync function like under this :

`String subscription = "something..."; String resourceGroupName= "something..."; String vmName= "something...";

VirtualMachine linuxVM = AzureUtils.azureResourceManager.virtualMachines().getById("/subscriptions/"+subscription+"/resourceGroups/"+resourceGroupName+"/providers/Microsoft.Compute/virtualMachines/"+vmName);

List cmdList = new ArrayList<>(); cmdList.add("sudo apt-get update"); cmdList.add("sudo apt-get install $name");

List parameters = new ArrayList(); RunCommandInputParameter arg1 = new RunCommandInputParameter(); arg1.withName("name"); arg1.withValue("git"); parameters.add(arg1);

linuxVM.runShellScriptAsync(cmdList, parameters);`

but this code not working... (but linuxVM.runShellScript() function is working..) why async function code is not working? could you check or let me know solution, please... (or something sample code please!)

Why is this not a Bug or a feature Request? is only async function not working.

Setup (please complete the following information if applicable):

weidongxu-microsoft commented 3 years ago

I didn't get it. async method does not work, until you either .block to wait on it, or use e.g. .flatMap or .map to concat it with other operations.

weidongxu-microsoft commented 3 years ago

https://github.com/ReactiveX/RxJava

cjhoon1014 commented 3 years ago

I didn't get it. async method does not work, until you either .block to wait on it, or use e.g. .flatMap or .map to concat it with other operations.

i was don't know how to use async method. okay, i will try this.

thanks.

weidongxu-microsoft commented 3 years ago

@cjhoon1014 Please note that the new SDK (2.x.x) switched to Reactor for async. https://aka.ms/azsdk/java/mgmt

If you only started using the Azure Java management SDK, you might be better start with the new SDK.

cjhoon1014 commented 3 years ago

@weidongxu-microsoft thank you so much. i will try this too. Thanks.