use of io.zeebe.broker.task.data.TaskEvent in project zeebe by zeebe-io.
the class TaskInstanceStreamProcessorTest method failure.
private TaskEvent failure() {
final TaskEvent event = new TaskEvent();
event.setState(TaskState.FAIL);
event.setType(BufferUtil.wrapString("foo"));
event.setLockOwner(BufferUtil.wrapString("bar"));
return event;
}
use of io.zeebe.broker.task.data.TaskEvent in project zeebe by zeebe-io.
the class TaskEventWriter method tryWriteTaskEvent.
/**
* Writes a follow-up event copying all properties of the source event and updating the state.
*/
public boolean tryWriteTaskEvent(final long sourceEventPosition, TaskState newState) {
final TypedEvent<TaskEvent> event = reader.readValue(sourceEventPosition, TaskEvent.class);
final TaskEvent taskEvent = event.getValue().setState(newState);
return writer.writeFollowupEvent(event.getKey(), taskEvent) >= 0;
}
use of io.zeebe.broker.task.data.TaskEvent in project zeebe by zeebe-io.
the class ClientApiMessageHandler method initEventTypeMap.
private void initEventTypeMap() {
eventsByType.put(EventType.DEPLOYMENT_EVENT, new DeploymentEvent());
eventsByType.put(EventType.TASK_EVENT, new TaskEvent());
eventsByType.put(EventType.WORKFLOW_INSTANCE_EVENT, new WorkflowInstanceEvent());
eventsByType.put(EventType.SUBSCRIBER_EVENT, new TopicSubscriberEvent());
eventsByType.put(EventType.SUBSCRIPTION_EVENT, new TopicSubscriptionEvent());
eventsByType.put(EventType.TOPIC_EVENT, new TopicEvent());
}
use of io.zeebe.broker.task.data.TaskEvent in project zeebe by zeebe-io.
the class IncidentStreamProcessorTest method shouldNotCreateIncidentIfRetriesAreUpdatedIntermittently.
/**
* Event order:
*
* Task FAILED -> UPDATE_RETRIES -> RETRIES UPDATED -> Incident CREATE -> Incident CREATE_REJECTED
*/
@Test
public void shouldNotCreateIncidentIfRetriesAreUpdatedIntermittently() {
// given
final TaskEvent task = taskFailed(0);
// trigger incident creation
final long key = rule.writeEvent(task);
task.setState(TaskState.RETRIES_UPDATED);
task.setRetries(1);
// triggering incident removal
rule.writeEvent(key, task);
// when
rule.runStreamProcessor(this::buildStreamProcessor);
// then
waitForEventInState(IncidentState.CREATE_REJECTED);
final List<TypedEvent<IncidentEvent>> incidentEvents = rule.events().onlyIncidentEvents().collect(Collectors.toList());
assertThat(incidentEvents).extracting("value.state").containsExactly(IncidentState.CREATE, IncidentState.CREATE_REJECTED);
}
use of io.zeebe.broker.task.data.TaskEvent in project zeebe by zeebe-io.
the class TaskInstanceStreamProcessorTest method cancel.
private TaskEvent cancel() {
final TaskEvent event = new TaskEvent();
event.setState(TaskState.CANCEL);
event.setType(BufferUtil.wrapString("foo"));
return event;
}
Aggregations