public AmazonSimpleWorkflow createSWFClient() { ClientConfiguration config = new ClientConfiguration().withSocketTimeout(70 * 1000); AWSCredentials awsCredentials = new BasicAWSCredentials(this.swfAccessId, this.swfSecretKey); AmazonSimpleWorkflow client = new AmazonSimpleWorkflowClient(awsCredentials, config); client.setEndpoint(this.swfServiceUrl); return client; }
public ResourceHelper() { InputStream credentialsStream = getClass().getClassLoader().getResourceAsStream(AWS_CREDENTIALS_FILE); if (credentialsStream != null) { try { credentials = new PropertiesCredentials(credentialsStream); } catch (IOException e) { logger.error(AWS_CRED_ERROR_READING); } s3cli = new AmazonS3Client(); ddb = new AmazonDynamoDBClient(credentials); ddb.setEndpoint("https://dynamodb.us-west-1.amazonaws.com", "dynamodb", "us-west-1"); mapper = new DynamoDBMapper(ddb); swfClient = new AmazonSimpleWorkflowClient(credentials); swfClient.setEndpoint("http://swf.us-west-1.amazonaws.com"); transClient = new AmazonElasticTranscoderClient(credentials); transClient.setEndpoint("elastictranscoder.us-west-1.amazonaws.com"); } else { logger.error(AWS_CRED_ERROR_NOT_FOUND); } }
public static void main(String[] args) throws Exception { ClientConfiguration config = new ClientConfiguration().withSocketTimeout(70 * 1000); String swfAccessId = System.getProperty("AWS_ACCESS_KEY_ID"); String swfSecretKey = System.getProperty("AWS_SECRET_KEY"); AWSCredentials awsCredentials = new BasicAWSCredentials(swfAccessId, swfSecretKey); AmazonSimpleWorkflow service = new AmazonSimpleWorkflowClient(awsCredentials, config); service.setEndpoint("https://swf.us-east-1.amazonaws.com"); String domain = "hoopla-sandbox"; String taskListToPoll = "BaconSWFTaskList"; ActivityWorker aw = new ActivityWorker(service, domain, taskListToPoll); aw.addActivitiesImplementation(new GreeterActivitiesImpl()); aw.start(); WorkflowWorker wfw = new WorkflowWorker(service, domain, taskListToPoll); wfw.addWorkflowImplementationType(GreeterWorkflowImpl.class); wfw.start(); }