This is an automated email from the ASF dual-hosted git repository.
tiagodolphine pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git
The following commit(s) were added to refs/heads/main by this push:
new 00356cecd1 [KOGITO-9816] Adding ProcessDefinitionRegistration to
springboot (#3310)
00356cecd1 is described below
commit 00356cecd197fdc454c0d8420945e6da80519dc8
Author: Tiago Dolphine <[email protected]>
AuthorDate: Wed Dec 6 10:35:54 2023 -0300
[KOGITO-9816] Adding ProcessDefinitionRegistration to springboot (#3310)
* KOGITO-9816 adding ProcessDefinitionRegistration to springboot
---
.../kogito/events/spring/KafkaEventPublisher.java | 4 +-
.../process/ProcessDefinitionRegistration.java | 45 ++++++++++++++++++++++
2 files changed, 46 insertions(+), 3 deletions(-)
diff --git
a/springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java
b/springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java
index d11aa00b70..1e164f255f 100644
---
a/springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java
+++
b/springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java
@@ -75,9 +75,7 @@ public class KafkaEventPublisher implements EventPublisher {
publishToTopic(event, USER_TASK_INSTANCES_TOPIC_NAME);
break;
case "ProcessDefinitionEvent":
- if (processDefinitionEvents) {
- publishToTopic(event, PROCESS_DEFINITIONS_TOPIC_NAME);
- }
+ publishToTopic(event, PROCESS_DEFINITIONS_TOPIC_NAME);
break;
default:
logger.debug("Unknown type of event '{}', ignoring for this
publisher", event.getType());
diff --git
a/springboot/starters/kogito-processes-spring-boot-starter/src/main/java/org/kie/kogito/process/ProcessDefinitionRegistration.java
b/springboot/starters/kogito-processes-spring-boot-starter/src/main/java/org/kie/kogito/process/ProcessDefinitionRegistration.java
new file mode 100644
index 0000000000..4fe52990ff
--- /dev/null
+++
b/springboot/starters/kogito-processes-spring-boot-starter/src/main/java/org/kie/kogito/process/ProcessDefinitionRegistration.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process;
+
+import org.kie.kogito.Application;
+import org.kie.kogito.services.registry.ProcessDefinitionEventRegistry;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ProcessDefinitionRegistration implements InitializingBean {
+ Processes processes;
+ ProcessDefinitionEventRegistry processDefinitionRegistry;
+
+ @Autowired
+ public ProcessDefinitionRegistration(Application application,
@Value("kogito.service.url") String serviceUrl, @Autowired(required = false)
Processes processes) {
+ this.processes = processes;
+ this.processDefinitionRegistry = new
ProcessDefinitionEventRegistry(application, serviceUrl);
+ }
+
+ @Override
+ public void afterPropertiesSet() {
+ if (processes != null) {
+ processDefinitionRegistry.register(processes);
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]