diff --git a/api/kogito-events-core/src/main/java/org/kie/kogito/event/process/ProcessDefinitionDataEvent.java b/api/kogito-events-core/src/main/java/org/kie/kogito/event/process/ProcessDefinitionDataEvent.java index 22bbcb8ca22..b58cece22f7 100644 --- a/api/kogito-events-core/src/main/java/org/kie/kogito/event/process/ProcessDefinitionDataEvent.java +++ b/api/kogito-events-core/src/main/java/org/kie/kogito/event/process/ProcessDefinitionDataEvent.java @@ -39,7 +39,7 @@ public ProcessDefinitionDataEvent(ProcessDefinitionEventBody body) { null, null, null, - null, - body.getType()); + DATA_CONTENT_TYPE, + null); } } \ No newline at end of file diff --git a/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java b/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java index d7ad2afe2a0..e42a0c85ab1 100644 --- a/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java +++ b/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java @@ -82,7 +82,7 @@ private Function, ProcessDefinitionDataEvent> mapProcessDefinition(Se .setId(p.id()) .setName(p.name()) .setVersion(p.version()) - .setType(ProcessDefinitionDataEvent.PROCESS_DEFINITION_EVENT) + .setType(p.type()) .setAddons(addons) .setEndpoint(getEndpoint(endpoint, p)) .setNodes(getNodesDefinitions(p)) diff --git a/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common/src/main/java/org/kie/kogito/quarkus/workflow/devservices/DataIndexEventPublisher.java b/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common/src/main/java/org/kie/kogito/quarkus/workflow/devservices/DataIndexEventPublisher.java index e1c7f6d9619..c78d02ae2f7 100644 --- a/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common/src/main/java/org/kie/kogito/quarkus/workflow/devservices/DataIndexEventPublisher.java +++ b/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common/src/main/java/org/kie/kogito/quarkus/workflow/devservices/DataIndexEventPublisher.java @@ -62,6 +62,18 @@ public void publish(DataEvent event) { LOGGER.debug("Sending event to data index: {}", event); switch (event.getType()) { + case "ProcessDefinitionDataEvent": + webClient.postAbs(dataIndexUrl.get() + "/definitions") + .putHeader(CONTENT_TYPE, CLOUD_EVENTS_CONTENT_TYPE) + .expect(ResponsePredicate.SC_ACCEPTED) + .sendJson(event, result -> { + if (result.failed()) { + LOGGER.error("Failed to send message to Data Index", result.cause()); + } else { + LOGGER.debug("Event published to Data Index"); + } + }); + break; case "ProcessInstanceErrorDataEvent": case "ProcessInstanceNodeDataEvent": case "ProcessInstanceSLADataEvent":