Example usage for com.amazonaws.services.simpleworkflow.model GetWorkflowExecutionHistoryRequest GetWorkflowExecutionHistoryRequest

List of usage examples for com.amazonaws.services.simpleworkflow.model GetWorkflowExecutionHistoryRequest GetWorkflowExecutionHistoryRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleworkflow.model GetWorkflowExecutionHistoryRequest GetWorkflowExecutionHistoryRequest.

Prototype

GetWorkflowExecutionHistoryRequest

Source Link

Usage

From source file:org.diksha.common.dyutils.SchedulerUDE.java

License:Apache License

public static void listActivitiesInWEI(SchedulerConfig schedulerConfig,
        List<WorkflowExecutionInfo> listWorkflowExecutionInfo) {

    AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient(
            DyDBUtils.getAwsCredentials());
    amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint());

    for (int cnt2 = 0; cnt2 < listWorkflowExecutionInfo.size(); cnt2++) {

        WorkflowExecutionInfo workflowExecutionInfo = listWorkflowExecutionInfo.get(cnt2);
        WorkflowExecution workflowExecution = workflowExecutionInfo.getExecution();
        //             System.out.println(workflowExecution);

        GetWorkflowExecutionHistoryRequest getWorkflowExecutionHistoryRequest = new GetWorkflowExecutionHistoryRequest()
                .withDomain(schedulerConfig.getDomain()).withExecution(workflowExecution);

        History history = amazonSimpleWorkflowClient
                .getWorkflowExecutionHistory(getWorkflowExecutionHistoryRequest);

        List<HistoryEvent> historyEvents;
        String nextPageToken;/* w  w w . ja  va2s.c  o  m*/

        do {
            historyEvents = history.getEvents();
            for (int cnt3 = 0; cnt3 < historyEvents.size(); cnt3++) {

                // , , , , , , 

                HistoryEvent he = historyEvents.get(cnt3);
                String eventType = historyEvents.get(cnt3).getEventType();
                if (eventType.equals("ActivityTaskStarted") || eventType.equals("ActivityTaskCompleted")
                        || eventType.equals("ActivityTaskFailed") || eventType.equals("ActivityTaskTimedOut")
                        || eventType.equals("ActivityTaskCanceled")
                        || eventType.equals("ActivityTaskCancelRequested")

                ) {

                    if (he.getEventType().equals("ActivityTaskCompleted"))
                        System.out.format("\n         %30s       %20s      ", he.getEventType(),
                                he.getEventTimestamp());

                }
            }
            nextPageToken = history.getNextPageToken();
            history.setNextPageToken(nextPageToken);
        } while (nextPageToken != null);

    }

}