public static void main(String[] args) throws Exception {
ConfigHelper configHelper = ConfigHelper.createConfig();
AmazonSimpleWorkflow swfService = configHelper.createSWFClient();
String domain = configHelper.getDomain();
final WorkflowWorker worker = new WorkflowWorker(swfService, domain, DECISION_TASK_LIST);
worker.addWorkflowImplementationType(CronWithRetryWorkflowImpl.class);
worker.setRegisterDomain(true);
worker.setDomainRetentionPeriodInDays(1);
worker.start();
System.out.println("Workflow Host Service Started...");
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
worker.shutdownAndAwaitTermination(1, TimeUnit.MINUTES);
System.out.println("Workflow Host Service Terminated...");
}
catch (InterruptedException e) {
e.printStackTrace();
}