Java 类com.amazonaws.services.simpleworkflow.flow.ActivityWorker 实例源码

项目:swf-flow-gradle    文件:GreeterWorker.java   
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();
}
项目:swf-horserace    文件:HorseActivitiesWorker.java   
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));

    }
项目:swf-horserace    文件:AnnouncerActivitiesWorker.java   
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));

    }
项目:aws-flow-maven-eclipse-samples    文件:ActivityHost.java   
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);        
}