Search in sources :

Example 6 with DeploymentEvent

use of io.zeebe.broker.workflow.data.DeploymentEvent in project zeebe by zeebe-io.

the class DeploymentEventWriter method writeDeploymentEvent.

/**
 * Writes a follow-up event copying all properties of the source event and updating the state.
 */
public void writeDeploymentEvent(final long sourceEventPosition, DeploymentState newState) {
    final TypedEvent<DeploymentEvent> event = reader.readValue(sourceEventPosition, DeploymentEvent.class);
    final DeploymentEvent deploymentEvent = event.getValue().setState(newState);
    actor.runUntilDone(() -> {
        final long position = writer.writeFollowupEvent(event.getKey(), deploymentEvent, copyRequestMetadata(event));
        if (position >= 0) {
            actor.done();
        } else {
            actor.yield();
        }
    });
}
Also used : DeploymentEvent(io.zeebe.broker.workflow.data.DeploymentEvent)

Aggregations

DeploymentEvent (io.zeebe.broker.workflow.data.DeploymentEvent)6 TopicSubscriberEvent (io.zeebe.broker.event.processor.TopicSubscriberEvent)1 TopicSubscriptionEvent (io.zeebe.broker.event.processor.TopicSubscriptionEvent)1 TypedBatchWriter (io.zeebe.broker.logstreams.processor.TypedBatchWriter)1 TopicEvent (io.zeebe.broker.system.log.TopicEvent)1 TaskEvent (io.zeebe.broker.task.data.TaskEvent)1 DeployedWorkflow (io.zeebe.broker.workflow.data.DeployedWorkflow)1 WorkflowInstanceEvent (io.zeebe.broker.workflow.data.WorkflowInstanceEvent)1 DirectBuffer (org.agrona.DirectBuffer)1