Search in sources :

Example 11 with TaskEvent

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;
}
Also used : TaskEvent(io.zeebe.broker.task.data.TaskEvent)

Example 12 with TaskEvent

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());
        }
    }
}
Also used : TaskEvent(io.zeebe.broker.task.data.TaskEvent)

Aggregations

TaskEvent (io.zeebe.broker.task.data.TaskEvent)12 TopicSubscriberEvent (io.zeebe.broker.event.processor.TopicSubscriberEvent)1 TopicSubscriptionEvent (io.zeebe.broker.event.processor.TopicSubscriptionEvent)1 TypedEvent (io.zeebe.broker.logstreams.processor.TypedEvent)1 TopicEvent (io.zeebe.broker.system.log.TopicEvent)1 DeploymentEvent (io.zeebe.broker.workflow.data.DeploymentEvent)1 WorkflowInstanceEvent (io.zeebe.broker.workflow.data.WorkflowInstanceEvent)1 Test (org.junit.Test)1