Example usage for com.amazonaws.services.simpleworkflow.model HistoryEvent getEventTimestamp

List of usage examples for com.amazonaws.services.simpleworkflow.model HistoryEvent getEventTimestamp

Introduction

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

Prototype


public java.util.Date getEventTimestamp() 

Source Link

Document

The date and time when the event occurred.

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;//from   w w  w  .j ava 2s .  com

        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);

    }

}