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

Java AmazonSimpleWorkflowClient类代码示例

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

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



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

示例1: main

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的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: setUp

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    configuration = new SWFConfiguration();
    configuration.setDomainName("testDomain");
    swClient = mock(AmazonSimpleWorkflowClient.class);
    configuration.setAmazonSWClient(swClient);
    configuration.setStartWorkflowOptionsParameters(Collections.<String, Object>emptyMap());

    endpoint = new SWFEndpoint();
    endpoint.setConfiguration(configuration);
    clientExternal = mock(DynamicWorkflowClientExternalImpl.class);

    camelSWFWorkflowClient = new CamelSWFWorkflowClient(endpoint, configuration) {
        @Override
        DynamicWorkflowClientExternal getDynamicWorkflowClient(String workflowId, String runId) {
            return clientExternal;
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:CamelSWFWorkflowClientTest.java


示例3: swf

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的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


示例4: createSWFClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的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


示例5: createSWClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
private AmazonSimpleWorkflowClient createSWClient() throws Exception {
    AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());

    ClientConfiguration clientConfiguration = new ClientConfiguration();
    if (!configuration.getClientConfigurationParameters().isEmpty()) {
        setProperties(clientConfiguration, configuration.getClientConfigurationParameters());
    }

    AmazonSimpleWorkflowClient client = new AmazonSimpleWorkflowClient(credentials, clientConfiguration);
    if (!configuration.getSWClientParameters().isEmpty()) {
        setProperties(client, configuration.getSWClientParameters());
    }
    return client;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:SWFEndpoint.java


示例6: createRegistry

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    amazonSWClient = mock(AmazonSimpleWorkflowClient.class);
    registry.bind("amazonSWClient", amazonSWClient);
    return registry;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:CamelSWFTestSupport.java


示例7: getClientProvider

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
@Produces
@Singleton
public SWFClientProvider getClientProvider() throws Exception {
    AmazonSimpleWorkflowClient client = SWFUtils.createWorkflowClient();
    if (client != null) {
        SWFUtils.registerDomain(client);
    }
    return new SWFClientProvider(client);
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:10,代码来源:SWFClientProducer.java


示例8: createWorkflowClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
public static AmazonSimpleWorkflowClient createWorkflowClient() {
    BasicCredentialsProvider credentials = BasicCredentialsProvider.standard();
    AmazonSimpleWorkflowClient client = !credentials.isValid() ? null : (AmazonSimpleWorkflowClient)
            AmazonSimpleWorkflowClientBuilder.standard()
            .withCredentials(credentials)
            .withRegion("eu-west-1")
            .build();
    return client;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:10,代码来源:SWFUtils.java


示例9: getSWClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
public AmazonSimpleWorkflowClient getSWClient() {
    return configuration.getAmazonSWClient() != null ? configuration.getAmazonSWClient() : amazonSWClient;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:SWFEndpoint.java


示例10: getAmazonSWClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
public AmazonSimpleWorkflowClient getAmazonSWClient() {
    return amazonSWClient;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:SWFConfiguration.java


示例11: setAmazonSWClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
/**
 * To use the given AmazonSimpleWorkflowClient as client
 */
public void setAmazonSWClient(AmazonSimpleWorkflowClient amazonSWClient) {
    this.amazonSWClient = amazonSWClient;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:SWFConfiguration.java


示例12: createSWFClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的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


示例13: createSWFClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的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


示例14: SWFClientProvider

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
SWFClientProvider(AmazonSimpleWorkflowClient client) {
    this.client = client;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:4,代码来源:SWFClientProducer.java


示例15: getClient

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
public AmazonSimpleWorkflowClient getClient() {
    return client;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:4,代码来源:SWFClientProducer.java


示例16: deciderAndWorker

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
@Test
public void deciderAndWorker() throws Exception {

    AmazonSimpleWorkflowClient swfClient = provider.getClient();
    Assume.assumeNotNull("AWS client not null", swfClient);

    WildFlyCamelContext camelctx = new WildFlyCamelContext();
    camelctx.getNamingContext().bind("swfClient", swfClient);
    camelctx.addRoutes(new RouteBuilder() {
        public void configure() {
            String options = "amazonSWClient=#swfClient&domainName=" + SWFUtils.DOMAIN + "&activityList=swf-alist&workflowList=swf-wlist&version=1.0";

            from("aws-swf://activity?" + options + "&eventName=processActivities")
                .log("FOUND ACTIVITY TASK ${body}")
                .setBody(constant("1"))
                .to("mock:worker");

            from("aws-swf://workflow?" + options + "&eventName=processWorkflows")
                .log("FOUND WORKFLOW TASK ${body}").filter(header(SWFConstants.ACTION).isEqualTo(SWFConstants.EXECUTE_ACTION))
                .to("aws-swf://activity?" + options + "&eventName=processActivities")
                .setBody(constant("Message two"))
                .to("aws-swf://activity?" + options + "&eventName=processActivities")
                .log("SENT ACTIVITY TASK ${body}")
                .to("mock:decider");

            from("direct:start")
                .to("aws-swf://workflow?" + options + "&eventName=processWorkflows")
                .log("SENT WORKFLOW TASK ${body}")
                .to("mock:starter");
        }
    });

    MockEndpoint decider = camelctx.getEndpoint("mock:decider", MockEndpoint.class);
    MockEndpoint worker = camelctx.getEndpoint("mock:worker", MockEndpoint.class);
    MockEndpoint starter = camelctx.getEndpoint("mock:starter", MockEndpoint.class);

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        producer.sendBody("direct:start", "Hello world!");

        starter.expectedMessageCount(1);
        decider.expectedMinimumMessageCount(1);
        worker.expectedMessageCount(2);

        String workflowId = starter.getReceivedExchanges().get(0).getIn().getHeader(SWFConstants.WORKFLOW_ID, String.class);
        Assert.assertNotNull(SWFConstants.WORKFLOW_ID + " not null", workflowId);
        SWFUtils.terminateWorkflowExecution(swfClient, workflowId);

    } finally {
        camelctx.stop();
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:54,代码来源:SWFIntegrationTest.java


示例17: terminateWorkflowExecution

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; //导入依赖的package包/类
public static void terminateWorkflowExecution(AmazonSimpleWorkflowClient swfClient, String workflowId) {
    TerminateWorkflowExecutionRequest terminateReq = new TerminateWorkflowExecutionRequest()
            .withWorkflowId(workflowId)
            .withDomain(DOMAIN);
    swfClient.terminateWorkflowExecution(terminateReq);
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:7,代码来源:SWFUtils.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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