List of usage examples for com.amazonaws.services.simpleworkflow AmazonSimpleWorkflowClient AmazonSimpleWorkflowClient
AmazonSimpleWorkflowClient(AwsSyncClientParams clientParams)
From source file:com.eucalyptus.cloudformation.workflow.WorkflowClientManager.java
License:Open Source License
public static void start() throws Exception { final AmazonSimpleWorkflow simpleWorkflowClient; if (USE_AWS_SWF) { System.setProperty("com.amazonaws.sdk.disableCertChecking", "true"); final BasicAWSCredentials creds = new BasicAWSCredentials(AWS_ACCESS_KEY, AWS_SECRET_KEY); simpleWorkflowClient = new AmazonSimpleWorkflowClient(creds); simpleWorkflowClient.setRegion(Region.getRegion(Regions.US_EAST_1)); } else {// ww w .j a va 2 s .c o m simpleWorkflowClient = Config.buildClient( CloudFormationAWSCredentialsProvider.CloudFormationUserSupplier.INSTANCE, SWF_CLIENT_CONFIG); } workflowClient = new WorkflowClient(CloudFormation.class, simpleWorkflowClient, SWF_DOMAIN, SWF_TASKLIST, SWF_WORKFLOW_WORKER_CONFIG, SWF_ACTIVITY_WORKER_CONFIG); workflowClient.start(); }
From source file:com.haskins.cloudtrailviewer.dialog.resourcedetail.detailpanels.SwfDomainDetail.java
License:Open Source License
@Override public String retrieveDetails(ResourceDetailRequest detailRequest) { String response = null;//from ww w . j a v a 2s . c o m try { AmazonSimpleWorkflow client = new AmazonSimpleWorkflowClient(credentials); client.setRegion(Region.getRegion(Regions.fromName(detailRequest.getRegion()))); DescribeDomainRequest request = new DescribeDomainRequest(); request.setName(detailRequest.getResourceName()); DomainDetail result = client.describeDomain(request); buildUI(result); } catch (IllegalArgumentException | AmazonClientException e) { response = e.getMessage(); LOGGER.log(Level.WARNING, "Problem retrieving SWF details from AWS", e); } return response; }
From source file:com.MobMonkey.Helpers.SimpleWorkFlow.ConfigHelper.java
License:Open Source License
public AmazonSimpleWorkflow createSWFClient() { AWSCredentials awsCredentials = new BasicAWSCredentials(this.swfAccessId, this.swfSecretKey); AmazonSimpleWorkflow client = new AmazonSimpleWorkflowClient(awsCredentials); client.setEndpoint(this.swfServiceUrl); return client; }
From source file:com.netflix.amazoncomponents.security.AmazonClientProvider.java
License:Apache License
public AmazonSimpleWorkflow getAmazonSimpleWorkflow(AWSCredentialsProviderChain providerChain, String region) { if (providerChain == null) { throw new IllegalArgumentException("Provider chain cannot be null"); }/*from w w w . j a va 2s .co m*/ AmazonSimpleWorkflowClient client = new AmazonSimpleWorkflowClient(providerChain); if (region != null && region.length() > 0) { client.setRegion(Region.getRegion(Regions.fromName(region))); } return client; }
From source file:org.diksha.common.dyutils.DyDBUtils.java
License:Apache License
public static void createDomain(String[] args) { AWSCredentials awsCredentials = getAwsCredentials(); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient(awsCredentials); amazonSimpleWorkflowClient.registerDomain(new RegisterDomainRequest().withName(args[0]) .withDescription(args[1]).withWorkflowExecutionRetentionPeriodInDays(args[2])); }
From source file:org.diksha.common.dyutils.DyDBUtils.java
License:Apache License
public static void deprecateDomain(String domainName) { AWSCredentials awsCredentials = getAwsCredentials(); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient(awsCredentials); amazonSimpleWorkflowClient.deprecateDomain(new DeprecateDomainRequest().withName(domainName)); }
From source file:org.diksha.common.dyutils.SchedulerUDE.java
License:Apache License
public void listStatus(String clientId, SchedulerConfig schedulerConfig) { DynamoDBMapper mapper = DyDBUtils.getDynamoDBMapper(); SchedulerWorkflowState schedulerWorkflowState = mapper.load(SchedulerWorkflowState.class, clientId); System.out.println("clientID : " + clientId); System.out.println(" Launch Parameters"); System.out//from w w w .j a v a2s . c o m .println(" Function: (" + this.functionName + ") with context = " + this.functionContext); System.out.println(" CronExpression : " + this.cronExpression); System.out.println(" RepeatTimes : " + this.repeatTimes); System.out.println(" StartTimeDate : " + this.startTimeDate); System.out.println(" EndTimeDate : " + this.endTimeDate); System.out.println(" Current State"); int cnt = schedulerWorkflowState.loopCount - 1; System.out.println(" status of loop : " + schedulerWorkflowState.getLoopState()); System.out.println(" # of times executed : " + cnt); System.out.println(" Last Executed @ : " + schedulerWorkflowState.lastExecutionTimeDate); System.out.println(" Next Proposed Time @ : " + schedulerWorkflowState.lastProposedTimeDate); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient( DyDBUtils.getAwsCredentials()); amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint()); ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest = new ListOpenWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()) .withExecutionFilter(new WorkflowExecutionFilter().withWorkflowId(clientId)) .withReverseOrder(new Boolean("true")) .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionInfos openWorkflowExecutionInfos = amazonSimpleWorkflowClient .listOpenWorkflowExecutions(listOpenWorkflowExecutionsRequest); List<WorkflowExecutionInfo> listOpenWorkflowExecutionInfo = openWorkflowExecutionInfos.getExecutionInfos(); ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest = new ListClosedWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()) .withExecutionFilter(new WorkflowExecutionFilter().withWorkflowId(clientId)) .withReverseOrder(new Boolean("true")) .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionInfos closedWorkflowExecutionInfos = amazonSimpleWorkflowClient .listClosedWorkflowExecutions(listClosedWorkflowExecutionsRequest); List<WorkflowExecutionInfo> listClosedWorkflowExecutionInfo = closedWorkflowExecutionInfos .getExecutionInfos(); listActivitiesInWEI(schedulerConfig, listOpenWorkflowExecutionInfo); listActivitiesInWEI(schedulerConfig, listClosedWorkflowExecutionInfo); System.out.println("\n"); }
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 ww . j a v a 2 s .c om 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); } }
From source file:org.diksha.common.dyutils.SchedulerUDE.java
License:Apache License
public static int countOpenExecutionsFromSWF(String config) { SchedulerConfig schedulerConfig = DyDBUtils.getSchedulerConfig(config); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient( DyDBUtils.getAwsCredentials()); amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint()); CountOpenWorkflowExecutionsRequest countOpenWorkflowExecutionsRequest = new CountOpenWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()); countOpenWorkflowExecutionsRequest//from w w w .j a v a2 s . c o m .setStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionCount workflowExecutionCount = amazonSimpleWorkflowClient .countOpenWorkflowExecutions(countOpenWorkflowExecutionsRequest); return workflowExecutionCount.getCount(); }
From source file:org.diksha.common.dyutils.SchedulerUDE.java
License:Apache License
public static ArrayList<String> listOpenExecutionsFromSWF(String config) { ArrayList<String> retValue = new ArrayList<String>(); SchedulerConfig schedulerConfig = DyDBUtils.getSchedulerConfig(config); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient( DyDBUtils.getAwsCredentials()); amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint()); ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest = new ListOpenWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()) .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionInfos workflowExecutionInfos = amazonSimpleWorkflowClient .listOpenWorkflowExecutions(listOpenWorkflowExecutionsRequest); String nextPageToken;/*from w w w.ja v a 2 s. c o m*/ do { java.util.List<WorkflowExecutionInfo> listWorkflowExecutionInfos = workflowExecutionInfos .getExecutionInfos(); for (int cnt = 0; cnt < listWorkflowExecutionInfos.size(); cnt++) { retValue.add(listWorkflowExecutionInfos.get(cnt).getExecution().getWorkflowId()); } nextPageToken = workflowExecutionInfos.getNextPageToken(); } while (nextPageToken != null); return retValue; }