Search in sources :

Example 6 with TaskEvent

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

Example 7 with TaskEvent

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

Example 8 with TaskEvent

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());
}
Also used : TopicEvent(io.zeebe.broker.system.log.TopicEvent) TopicSubscriptionEvent(io.zeebe.broker.event.processor.TopicSubscriptionEvent) TopicSubscriberEvent(io.zeebe.broker.event.processor.TopicSubscriberEvent) TaskEvent(io.zeebe.broker.task.data.TaskEvent) WorkflowInstanceEvent(io.zeebe.broker.workflow.data.WorkflowInstanceEvent) DeploymentEvent(io.zeebe.broker.workflow.data.DeploymentEvent)

Example 9 with TaskEvent

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);
}
Also used : TypedEvent(io.zeebe.broker.logstreams.processor.TypedEvent) TaskEvent(io.zeebe.broker.task.data.TaskEvent) Test(org.junit.Test)

Example 10 with TaskEvent

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;
}
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