• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AmazonSimpleWorkflow类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow的典型用法代码示例。如果您正苦于以下问题:Java AmazonSimpleWorkflow类的具体用法?Java AmazonSimpleWorkflow怎么用?Java AmazonSimpleWorkflow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AmazonSimpleWorkflow类属于com.amazonaws.services.simpleworkflow包,在下文中一共展示了AmazonSimpleWorkflow类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
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();
}
 
开发者ID:csquire,项目名称:swf-flow-gradle,代码行数:22,代码来源:GreeterWorker.java


示例2: multiplePages

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
@Test
public void multiplePages(@Mocked AmazonSimpleWorkflow swf) {
    PollForDecisionTaskRequest initialRequest = new PollForDecisionTaskRequest();
    List<HistoryEvent> events = loadHistoryEvents("fixtures/simple_workflow.json");
    int numberOfPages = 4;
    int sizePerPage = (int) Math.ceil( (double) events.size() / numberOfPages);
    List<List<HistoryEvent>> pages = Lists.partition(events, sizePerPage);
    assertThat("partitioned incorrectly", pages, hasSize(numberOfPages));
    DecisionTask initialDecisionTask = new DecisionTask().withTaskToken("xyz")
            .withNextPageToken("1").withEvents(pages.get(0));
    DecisionTaskIterator decisionTaskIterator = new DecisionTaskIterator(swf, initialRequest, initialDecisionTask);
    new Expectations() {{
        swf.pollForDecisionTask(initialRequest);times=(numberOfPages-1);
        returns(new DecisionTask().withTaskToken("abc").withNextPageToken("2").withEvents(pages.get(1)),
                new DecisionTask().withTaskToken("def").withNextPageToken("3").withEvents(pages.get(2)),
                new DecisionTask().withTaskToken("ghi").withEvents(pages.get(3)));
    }};

    assertThat(Lists.newArrayList(decisionTaskIterator), is(events));
}
 
开发者ID:fzakaria,项目名称:WaterFlow,代码行数:21,代码来源:DecisionTaskIteratorTest.java


示例3: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    ConfigHelper configHelper = ConfigHelper.createConfig();
    AmazonSimpleWorkflow swfService = configHelper.createSWFClient();
    String domain = configHelper.getDomain();

    HelloWorldWorkflowClientExternalFactory clientFactory = new HelloWorldWorkflowClientExternalFactoryImpl(swfService,
            domain);
    HelloWorldWorkflowClientExternal workflow = clientFactory.getClient();
    
    // Start Wrokflow Execution
    workflow.helloWorld("User");
    
    // WorkflowExecution is available after workflow creation 
    WorkflowExecution workflowExecution = workflow.getWorkflowExecution();
    System.out.println("Started helloWorld workflow with workflowId=\"" + workflowExecution.getWorkflowId()
            + "\" and runId=\"" + workflowExecution.getRunId() + "\"");
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:18,代码来源:WorkflowExecutionStarter.java


示例4: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    if (args.length < 2) {
        System.err.println("Usage: java " + WorkflowExecutionGetState.class.getName() + " <workflowId> <runId>");
        System.exit(1);
    }
    ConfigHelper configHelper = ConfigHelper.createConfig();
    AmazonSimpleWorkflow swfService = configHelper.createSWFClient();
    String domain = configHelper.getDomain();
    
    
    WorkflowExecution workflowExecution = new WorkflowExecution();
    String workflowId = args[1];
    workflowExecution.setWorkflowId(workflowId);
    String runId = args[2];
    workflowExecution.setRunId(runId);
    
    GenericWorkflowClientExternal client = new GenericWorkflowClientExternalImpl(swfService, domain);
    
    String state = client.getWorkflowState(workflowExecution);
    
    System.out.println("Current state of " + workflowExecution + ":");
    System.out.println(state);
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:24,代码来源:WorkflowExecutionGetState.java


示例5: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    if (args.length < 2) {
        System.err.println("Usage: java " + WorkflowExecutionHistoryPrinter.class.getName() + " <workflowId> <runId>");
        System.exit(1);
    }
    ConfigHelper configHelper = ConfigHelper.createConfig();
    AmazonSimpleWorkflow swfService = configHelper.createSWFClient();
    String domain = configHelper.getDomain();
    
    
    WorkflowExecution workflowExecution = new WorkflowExecution();
    String workflowId = args[0];
    workflowExecution.setWorkflowId(workflowId);
    String runId = args[1];
    workflowExecution.setRunId(runId);
    System.out.println(WorkflowExecutionUtils.prettyPrintHistory(swfService, domain, workflowExecution, true));
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:18,代码来源:WorkflowExecutionHistoryPrinter.java


示例6: DataMungServiceImpl

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
@Autowired
public DataMungServiceImpl( AmazonSimpleWorkflow swfService,
                            ServiceConfig config )
{
    instanceWorkflowFactory =
        new ExportInstanceWorkflowClientExternalFactoryImpl(
                                                             swfService,
                                                             config.getSwfDomainName() );
    snapshotWorkflowFactory =
        new ExportSnapshotWorkflowClientExternalFactoryImpl(
                                                             swfService,
                                                             config.getSwfDomainName() );

    this.swfService = swfService;
    this.swfDomain = config.getSwfDomainName();
}
 
开发者ID:jiaqi,项目名称:datamung,代码行数:17,代码来源:DataMungServiceImpl.java


示例7: DecisionTaskIterator

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public DecisionTaskIterator(AmazonSimpleWorkflow swf, PollForDecisionTaskRequest request,
                            DecisionTask startingResponse) {
    this.swf = swf;
    this.request = request;
    this.nextPageToken = startingResponse.getNextPageToken();
    this.currentPage = Optional.ofNullable(startingResponse.getEvents())
            .map(List::iterator).orElse( Collections.emptyIterator());
    this.isLastPage = this.nextPageToken == null;
}
 
开发者ID:fzakaria,项目名称:WaterFlow,代码行数:10,代码来源:DecisionTaskIterator.java


示例8: swf

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
@Value.Default
public AmazonSimpleWorkflow swf() {
    //SWF holds the connection for 60 seconds to see if a decision is available
    final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(60);
    final Duration DEFAULT_SOCKET_TIMEOUT = DEFAULT_CONNECTION_TIMEOUT.plusSeconds(10);
    return new AmazonSimpleWorkflowClient(new DefaultAWSCredentialsProviderChain(),
            new ClientConfiguration().withConnectionTimeout((int) DEFAULT_CONNECTION_TIMEOUT.toMillis())
                    .withSocketTimeout((int) DEFAULT_SOCKET_TIMEOUT.toMillis()));
}
 
开发者ID:fzakaria,项目名称:WaterFlow,代码行数:10,代码来源:Config.java


示例9: createSWFClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
/**
 * Create a new SWF client given the current configuration.
 *
 * @return an AmazonSimpleWorkflow client
 */
AmazonSimpleWorkflow createSWFClient() {
  AWSCredentials credentials = new DefaultAWSCredentialsProviderChain().getCredentials();
  AmazonSimpleWorkflow service =
      new AmazonSimpleWorkflowClient(credentials, new ClientConfiguration().withSocketTimeout(SOCKET_TIMEOUT));
  service.setEndpoint(swfServiceUrl);
  return service;
}
 
开发者ID:soofaloofa,项目名称:swf-starter,代码行数:13,代码来源:Config.java


示例10: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
/**
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    //get task token and result from user 
    String taskToken = getTaskToken();
    String result = getResult();

    //complete the activity task
    AmazonSimpleWorkflow swfService = createSWFClient();
    ManualActivityCompletionClientFactory manualCompletionClientFactory = new ManualActivityCompletionClientFactoryImpl(
            swfService);
    ManualActivityCompletionClient manualCompletionClient = manualCompletionClientFactory.getClient(taskToken);
    manualCompletionClient.complete(result);
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:16,代码来源:HumanTaskConsole.java


示例11: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    if (args.length < 3) {
        System.err.println("Usage: java " + WorkflowExecutionFlowThreadDumper.class.getName()
                + "<workflow implementation class> <workflowId> <runId>");
        System.exit(1);
    }
    ConfigHelper configHelper = ConfigHelper.createConfig();
    AmazonSimpleWorkflow swfService = configHelper.createSWFClient();
    String domain = configHelper.getDomain();

    WorkflowExecution workflowExecution = new WorkflowExecution();
    String workflowId = args[1];
    workflowExecution.setWorkflowId(workflowId);
    String runId = args[2];
    workflowExecution.setRunId(runId);

    String implementationTypeName = args[0];
    @SuppressWarnings("unchecked")
    Class<Object> workflowImplementationType = (Class<Object>) Class.forName(implementationTypeName);
    WorkflowReplayer<Object> replayer = new WorkflowReplayer<Object>(swfService, domain, workflowExecution,
            workflowImplementationType);

    System.out.println("Beginning workflow replay for " + workflowExecution);
    try {
        String flowThreadDump = replayer.getAsynchronousThreadDumpAsString();
        System.out.println("Workflow asynchronous thread dump:");
        System.out.println(flowThreadDump);
    }
    catch (WorkflowException e) {
        System.out.println("No asynchronous thread dump available as workflow has failed: " + e);
    }
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:33,代码来源:WorkflowExecutionFlowThreadDumper.java


示例12: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    if (args.length < 3) {
        System.err.println("Usage: java " + WorkflowExecutionReplayer.class.getName()
                + "<workflow implementation class> <workflowId> <runId>");
        System.exit(1);
    }
    ConfigHelper configHelper = ConfigHelper.createConfig();
    AmazonSimpleWorkflow swfService = configHelper.createSWFClient();
    String domain = configHelper.getDomain();

    WorkflowExecution workflowExecution = new WorkflowExecution();
    String workflowId = args[1];
    workflowExecution.setWorkflowId(workflowId);
    String runId = args[2];
    workflowExecution.setRunId(runId);

    String implementationTypeName = args[0];
    @SuppressWarnings("unchecked")
    Class<Object> workflowImplementationType = (Class<Object>) Class.forName(implementationTypeName);
    WorkflowReplayer<Object> replayer = new WorkflowReplayer<Object>(swfService, domain, workflowExecution,
            workflowImplementationType);

    System.out.println("Beginning workflow replay for " + workflowExecution);
    Object workflow = replayer.loadWorkflow();
    System.out.println("Workflow implementation object:");
    System.out.println(workflow);

    System.out.println("Done workflow replay for " + workflowExecution);
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:30,代码来源:WorkflowExecutionReplayer.java


示例13: createSWFClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
static AmazonSimpleWorkflow createSWFClient() {
    AWSCredentials awsCredentials = new BasicAWSCredentials("{swfAccessId}", "{swfSecretKey}");
    AmazonSimpleWorkflow client = new AmazonSimpleWorkflowClient(awsCredentials);
    client.setEndpoint("{swfServiceUrl}");
    return client;
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:7,代码来源:HumanTaskConsole.java


示例14: createSWFClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public AmazonSimpleWorkflow createSWFClient() {
    AWSCredentials awsCredentials = new BasicAWSCredentials(this.swfAccessId, this.swfSecretKey);
    AmazonSimpleWorkflow client = new AmazonSimpleWorkflowClient(awsCredentials);
    client.setEndpoint(this.swfServiceUrl);
    return client;
}
 
开发者ID:pedropaulovc,项目名称:aws-flow-maven-eclipse-samples,代码行数:7,代码来源:ConfigHelper.java


示例15: service

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public abstract AmazonSimpleWorkflow service(); 
开发者ID:fzakaria,项目名称:WaterFlow,代码行数:2,代码来源:ActivityContext.java


示例16: swf

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; //导入依赖的package包/类
public abstract AmazonSimpleWorkflow swf(); 
开发者ID:fzakaria,项目名称:WaterFlow,代码行数:2,代码来源:BasePollerPool.java



注:本文中的com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ImageDeformationByFilters类代码示例发布时间:2022-05-23
下一篇:
Java ComponentDefinitionRegistry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap