当前位置: 首页>>代码示例>>Java>>正文


Java PollForActivityTaskRequest类代码示例

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


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

示例1: receivesDecisionTask

import com.amazonaws.services.simpleworkflow.model.PollForActivityTaskRequest; //导入依赖的package包/类
@Test
public void receivesDecisionTask() throws Exception {
    result.expectedMinimumMessageCount(1);
    result.expectedMessagesMatches(new Predicate() {
        public boolean matches(Exchange exchange) {
            return exchange.getIn().getHeader(SWFConstants.ACTION).equals(SWFConstants.EXECUTE_ACTION)
                    && exchange.getIn().getBody(Object[].class)[0].equals("test");
        }
    });

    ActivityTask activityTask = new ActivityTask();
    activityTask.setTaskToken("token");
    activityTask.setInput("[\"[Ljava.lang.Object;\",[\"test\"]]");
    when(amazonSWClient.pollForActivityTask(any(PollForActivityTaskRequest.class))).thenReturn(activityTask);

    context.start();

    assertMockEndpointsSatisfied();
    verify(amazonSWClient, atLeastOnce()).pollForActivityTask(any(PollForActivityTaskRequest.class));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CamelSWFActivityConsumerTest.java

示例2: createPollForActivityTask

import com.amazonaws.services.simpleworkflow.model.PollForActivityTaskRequest; //导入依赖的package包/类
public static PollForActivityTaskRequest createPollForActivityTask(Domain domain, TaskListName taskList, Name name) {
    return new PollForActivityTaskRequest()
            .withDomain(domain.value())
            .withTaskList(new TaskList()
                    .withName(taskList.value()))
            .withIdentity(name.value());
}
 
开发者ID:fzakaria,项目名称:WaterFlow,代码行数:8,代码来源:ActivityPoller.java

示例3: pollAndExecute

import com.amazonaws.services.simpleworkflow.model.PollForActivityTaskRequest; //导入依赖的package包/类
public static void pollAndExecute() {
    while (!terminate) {
        System.out.println("Polling for an activity task from the tasklist '"
                + HelloTypes.TASKLIST + "' in the domain '" +
                HelloTypes.DOMAIN + "'.");

        ActivityTask task = swf.pollForActivityTask(new PollForActivityTaskRequest()
            .withDomain(HelloTypes.DOMAIN)
            .withTaskList(new TaskList().withName(HelloTypes.TASKLIST)));

        String taskToken = task.getTaskToken();

        if (taskToken != null) {
            String result = null;
            Throwable error = null;

            try {
                System.out.println("Executing the activity task with input '"
                        + task.getInput() + "'.");
                result = executeActivityTask(task.getInput());
            }
            catch (Throwable th) {
                error = th;
            }

            if (error == null) {
                System.out.println("The activity task succeeded with result '"
                        + result + "'.");
                swf.respondActivityTaskCompleted(
                    new RespondActivityTaskCompletedRequest()
                        .withTaskToken(taskToken)
                        .withResult(result));
            }
            else {
                System.out.println("The activity task failed with the error '"
                        + error.getClass().getSimpleName() + "'.");
                swf.respondActivityTaskFailed(
                    new RespondActivityTaskFailedRequest()
                        .withTaskToken(taskToken)
                        .withReason(error.getClass().getSimpleName())
                        .withDetails(error.getMessage()));
            }
        }
    }
}
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:46,代码来源:ActivityWorkerWithGracefulShutdown.java


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