use of io.zeebe.broker.task.data.TaskEvent in project zeebe by zeebe-io.
the class TaskLockExpirationStreamProcessorTest method taskLocked.
private TaskEvent taskLocked() {
final TaskEvent event = new TaskEvent();
event.setState(TaskState.LOCKED);
event.setType(BufferUtil.wrapString("foo"));
return event;
}
use of io.zeebe.broker.task.data.TaskEvent in project zeebe by zeebe-io.
the class LockTaskStreamProcessor method processEvent.
@Override
public void processEvent(TypedEvent<TaskEvent> event) {
selectedSubscriber = null;
final TaskEvent taskEvent = event.getValue();
final boolean handlesTaskType = BufferUtil.equals(taskEvent.getType(), subscribedTaskType);
if (handlesTaskType && taskEvent.getRetries() > 0) {
selectedSubscriber = getNextAvailableSubscription();
if (selectedSubscriber != null) {
final long lockTimeout = ActorClock.currentTimeMillis() + selectedSubscriber.getLockDuration();
taskEvent.setState(TaskState.LOCK).setLockTime(lockTimeout).setLockOwner(selectedSubscriber.getLockOwner());
}
}
}
Aggregations