use of io.zeebe.client.event.TopicEventType in project zeebe by zeebe-io.
the class TopicSubscriptionBuilderImpl method dispatchEvent.
protected void dispatchEvent(GeneralEventImpl event) throws Exception {
final TopicEventType eventType = event.getMetadata().getType();
if (TopicEventType.TASK == eventType && taskEventHandler != null) {
final TaskEventImpl taskEvent = msgPackMapper.convert(event.getAsMsgPack(), TaskEventImpl.class);
taskEvent.updateMetadata(event.getMetadata());
taskEventHandler.handle(taskEvent);
} else if (TopicEventType.WORKFLOW_INSTANCE == eventType && wfInstanceEventHandler != null) {
final WorkflowInstanceEventImpl wfInstanceEvent = msgPackMapper.convert(event.getAsMsgPack(), WorkflowInstanceEventImpl.class);
wfInstanceEvent.updateMetadata(event.getMetadata());
wfInstanceEventHandler.handle(wfInstanceEvent);
} else if (TopicEventType.WORKFLOW == eventType && wfEventHandler != null) {
final WorkflowEventImpl wfEvent = msgPackMapper.convert(event.getAsMsgPack(), WorkflowEventImpl.class);
wfEvent.updateMetadata(event.getMetadata());
wfEventHandler.handle(wfEvent);
} else if (TopicEventType.INCIDENT == eventType && incidentEventHandler != null) {
final IncidentEventImpl incidentEvent = msgPackMapper.convert(event.getAsMsgPack(), IncidentEventImpl.class);
incidentEvent.updateMetadata(event.getMetadata());
incidentEventHandler.handle(incidentEvent);
} else if (TopicEventType.RAFT == eventType && raftEventHandler != null) {
final RaftEventImpl raftEvent = msgPackMapper.convert(event.getAsMsgPack(), RaftEventImpl.class);
raftEvent.updateMetadata(event.getMetadata());
raftEventHandler.handle(raftEvent);
} else if (defaultEventHandler != null) {
defaultEventHandler.handle(event);
}
}
Aggregations