Java SDK 라이브러리를 사용하여 Java 애플리케이션에서 Orchestrator REST API의 작업을 호출하고 개체로 직접 작업할 수 있습니다.

Orchestrator REST SDK의 모든 RESTful 웹 서비스에는 해당 서비스를 사용하여 실행할 수 있는 작업에 해당하는 메서드가 포함된 래핑 Java 클래스가 있습니다.

Java REST SDK는 Orchestrator와 함께 설치됩니다. Java REST SDK 아티팩트는 다음 위치에서 제공됩니다.


Orchestrator Appliance를 배포한 경우에만 이러한 아티팩트에 액세스할 수 있습니다.

  • https://orchestrator_host:port/vco-repo/com/vmware/o11n/o11n-rest-client/

  • https://orchestrator_host:port/vco-repo/com/vmware/o11n/o11n-rest-client-examples/

  • https://orchestrator_host:port/vco-repo/com/vmware/o11n/o11n-rest-client-services/

  • https://orchestrator_host:port/vco-repo/com/vmware/o11n/o11n-rest-client-stubs/

워크플로를 실행하고 완료될 때까지 대기

다음 예제 코드는 워크플로를 실행하고 해당 워크플로가 완료될 때까지 대기합니다.

//start a new session to Orchestrator by using specified credentials
VcoSession session = DefaultVcoSessionFactory.newLdapSession(new URI("https://orchestrator-server:8281/vco/api/"), "username", "password");

//create the services
WorkflowService workflowService = new WorkflowService(session);
ExecutionService executionService = new ExecutionService(session);

//find a workflow by ID
Workflow workflow = workflowService.getWorkflow("1231235");

//create an ExecutionContext from the user's input
ExecutionContext context = new ExecutionContextBuilder().addParam("name", "Jerry").addParam("age", 18).build();

//run the workflow
WorkflowExecution execution = executionService.execute(workflow, context);

//wait for the workflow to reach the user interaction state, checking every 500 milliseconds
execution = executionService.awaitState(execution, 500, 10, WorkflowExecutionState.CANCELED, WorkflowExecutionState.FAILED, WorkflowExecutionState.COMPLETED);

String nameParamValue = new ParameterExtractor().fromTheOutputOf(execution).extractString("name");
System.out.println("workflow was executed with 'name' input set to" + nameParamValue);