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

项目: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    文件:RaceFlowWorker.java   
private RaceFlowWorker() throws Exception {

        /*
         * Configure an Flow Framework WORKFLOW worker with a domain and queue.
         */
        this.worker = new WorkflowWorker(SWF, DOMAIN, TASKLIST);

        /*
         * Can add multiple worker classes. FF takes care of the lifecycle for
         * each instance. A new instance of the registered class is created and
         * run for every decision.
         */
        this.worker.addWorkflowImplementationType(RaceFlowImpl.class);

    }
项目:aws-flow-maven-eclipse-samples    文件:WorkflowHost.java   
private void startWorkflowWorker(ConfigHelper configHelper) throws Exception {
    System.out.println("Starting Workflow Host Service...");

    String taskList = configHelper.getValueFromConfig(BookingConfigKeys.WORKFLOW_WORKER_TASKLIST);
    worker = new WorkflowWorker(swfService, domain, taskList);
    worker.setDomainRetentionPeriodInDays(domainRetentionPeriodInDays);
    worker.setRegisterDomain(true);
    worker.addWorkflowImplementationType(BookingWorkflowImpl.class);
    // Start the worker threads
    worker.start();

    System.out.println("Workflow Host Service Started...");
}