public static void main(String[] args) throws Exception { AmazonSimpleWorkflow service = new AmazonSimpleWorkflowClient(); service.setEndpoint("https://swf.us-east-1.amazonaws.com"); String domain = "helloWorldWalkthrough"; String taskListToPoll = "HelloWorldAsyncList"; WorkflowWorker wfw = new WorkflowWorker(service, domain, taskListToPoll); wfw.setRegisterDomain(true); wfw.setDomainRetentionPeriodInDays(1); wfw.addWorkflowImplementationType(GreeterWorkflowImpl.class); wfw.start(); ActivityWorker aw = new ActivityWorker(service, domain, taskListToPoll); aw.addActivitiesImplementation(new GreeterActivitiesImpl()); aw.start(); GreeterWorkflowClientExternalFactory clientFactory = new GreeterWorkflowClientExternalFactoryImpl(service, domain); GreeterWorkflowClientExternal client = clientFactory.getClient(); client.greet(); }
private HorseActivitiesWorker(final int instance) throws Exception { /* * Configure an Flow Framework ACTIVITY worker with a domain and queue. */ this.worker = new ActivityWorker(SWF, DOMAIN, TASKLIST); /* * Can add multiple activities implementation instances. Each is a * singleton that remains active for the duration of the worker. There * should be no shared mutable state in an activities implementation. */ this.worker.addActivitiesImplementation(new HorseActivitiesImpl( instance)); }
private AnnouncerActivitiesWorker(final int instance) throws Exception { /* * Configure an Flow Framework ACTIVITY worker with a domain and queue. */ this.worker = new ActivityWorker(SWF, DOMAIN, TASKLIST); /* * Can add multiple activities implementation instances. Each is a * singleton that remains active for the duration of the worker. There * should be no shared mutable state in an activities implementation. */ this.worker.addActivitiesImplementation(new AnnouncerActivitiesImpl( instance)); }
private void startWorker(ConfigHelper configHelper) throws Exception { // Create activity implementations BookingActivities bookingActivitiesImpl = new BookingActivitiesImpl(); // Start worker to poll the common task list String taskList = configHelper.getValueFromConfig(BookingConfigKeys.ACTIVITY_WORKER_TASKLIST); worker = new ActivityWorker(swfService, domain, taskList); worker.setDomainRetentionPeriodInDays(domainRetentionPeriodInDays); worker.setRegisterDomain(true); worker.addActivitiesImplementation(bookingActivitiesImpl); worker.start(); System.out.println("Worker Started for Activity Task List: " + taskList); }