Search in sources :

Example 1 with ActivityTaskStartedEventAttributes

use of com.uber.cadence.ActivityTaskStartedEventAttributes 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());
    });
}
Also used : ActivityTaskStartedEventAttributes(com.uber.cadence.ActivityTaskStartedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Aggregations

ActivityTaskStartedEventAttributes (com.uber.cadence.ActivityTaskStartedEventAttributes)1 HistoryEvent (com.uber.cadence.HistoryEvent)1