use of com.uber.cadence.HistoryEvent in project cadence-client by uber-java.
the class StateMachines method failDecisionTask.
private static void failDecisionTask(RequestContext ctx, DecisionTaskData data, RespondDecisionTaskFailedRequest request, long notUsed) {
DecisionTaskFailedEventAttributes a = new DecisionTaskFailedEventAttributes().setIdentity(request.getIdentity()).setCause(request.getCause()).setDetails(request.getDetails()).setStartedEventId(data.previousStartedEventId).setScheduledEventId(data.scheduledEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.DecisionTaskFailed).setDecisionTaskFailedEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.HistoryEvent in project cadence-client by uber-java.
the class StateMachines method childWorkflowCanceled.
private static void childWorkflowCanceled(RequestContext ctx, ChildWorkflowData data, ChildWorkflowExecutionCanceledEventAttributes a, long notUsed) {
a.setInitiatedEventId(data.initiatedEventId);
a.setStartedEventId(data.startedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ChildWorkflowExecutionCanceled).setChildWorkflowExecutionCanceledEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.HistoryEvent in project cadence-client by uber-java.
the class StateMachines method failActivityTaskById.
private static void failActivityTaskById(RequestContext ctx, ActivityTaskData data, RespondActivityTaskFailedByIDRequest request) {
ActivityTaskFailedEventAttributes a = new ActivityTaskFailedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId).setDetails(request.getDetails()).setReason(request.getReason()).setIdentity(request.getIdentity()).setStartedEventId(data.startedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskFailed).setActivityTaskFailedEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.HistoryEvent in project cadence-client by uber-java.
the class StateMachines method childWorkflowStarted.
private static void childWorkflowStarted(RequestContext ctx, ChildWorkflowData data, ChildWorkflowExecutionStartedEventAttributes a, long notUsed) {
a.setInitiatedEventId(data.initiatedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ChildWorkflowExecutionStarted).setChildWorkflowExecutionStartedEventAttributes(a);
long startedEventId = ctx.addEvent(event);
ctx.onCommit((historySize) -> {
data.startedEventId = startedEventId;
data.execution = a.getWorkflowExecution();
});
}
use of com.uber.cadence.HistoryEvent in project cadence-client by uber-java.
the class StateMachines method startActivityTask.
private static void startActivityTask(RequestContext ctx, ActivityTaskData data, PollForActivityTaskRequest request, long notUsed) {
ActivityTaskStartedEventAttributes a = new ActivityTaskStartedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskStarted).setActivityTaskStartedEventAttributes(a);
long startedEventId = ctx.addEvent(event);
ctx.onCommit((historySize) -> {
data.startedEventId = startedEventId;
data.activityTask.setTaskToken(new ActivityId(ctx.getExecutionId(), data.activityTask.getActivityId()).toBytes());
data.activityTask.setStartedTimestamp(ctx.currentTimeInNanoseconds());
});
}
Aggregations