use of com.uber.cadence.ActivityTaskCompletedEventAttributes in project cadence-client by uber-java.
the class StateMachines method completeActivityTaskByTaskToken.
private static void completeActivityTaskByTaskToken(RequestContext ctx, ActivityTaskData data, RespondActivityTaskCompletedRequest request) {
ActivityTaskCompletedEventAttributes a = new ActivityTaskCompletedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId).setResult(request.getResult()).setIdentity(request.getIdentity()).setStartedEventId(data.startedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskCompleted).setActivityTaskCompletedEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.ActivityTaskCompletedEventAttributes in project cadence-client by uber-java.
the class StateMachines method completeActivityTaskById.
private static void completeActivityTaskById(RequestContext ctx, ActivityTaskData data, RespondActivityTaskCompletedByIDRequest request) {
ActivityTaskCompletedEventAttributes a = new ActivityTaskCompletedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId).setResult(request.getResult()).setIdentity(request.getIdentity()).setStartedEventId(data.startedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskCompleted).setActivityTaskCompletedEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.ActivityTaskCompletedEventAttributes in project cadence-client by uber-java.
the class ActivityDecisionContext method handleActivityTaskCompleted.
void handleActivityTaskCompleted(HistoryEvent event) {
ActivityTaskCompletedEventAttributes attributes = event.getActivityTaskCompletedEventAttributes();
String activityId = decisions.getActivityId(attributes);
if (decisions.handleActivityTaskClosed(activityId)) {
OpenRequestInfo<byte[], ActivityType> scheduled = scheduledActivities.remove(activityId);
if (scheduled != null) {
byte[] result = attributes.getResult();
BiConsumer<byte[], Exception> completionHandle = scheduled.getCompletionCallback();
completionHandle.accept(result, null);
}
}
}
Aggregations