You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tiagodolphine (via GitHub)" <gi...@apache.org> on 2023/10/16 17:12:27 UTC

[PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

tiagodolphine opened a new pull request, #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252

   Many thanks for submitting your Pull Request :heart:! 
   
   Please make sure that your PR meets the following requirements:
   
   - [ ] You have read the [contributors guide](CONTRIBUTING.md)
   - [ ] Your code is properly formatted according to [this configuration](https://github.com/apache/incubator-kie-kogito-runtimes/tree/main/kogito-build/kogito-ide-config)
   - [ ] Pull Request title is properly formatted: `KOGITO-XYZ Subject`
   - [ ] Pull Request title contains the target branch if not targeting main: `[0.9.x] KOGITO-XYZ Subject`
   - [ ] Pull Request contains link to the JIRA issue
   - [ ] Pull Request contains link to any dependent or related Pull Request
   - [ ] Pull Request contains description of the issue
   - [ ] Pull Request does not include fixes for issues other than the main ticket
   
   <details>
   <summary>
   How to replicate CI configuration locally?
   </summary>
   
   Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use [build-chain tool](https://github.com/kiegroup/github-action-build-chain) to handle cross repository builds and be sure that we always use latest version of the code for each repository.
    
   [build-chain tool](https://github.com/kiegroup/github-action-build-chain) is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See [local execution](https://github.com/kiegroup/github-action-build-chain#local-execution) details to get more information about it.
   </details>
   
   <details>
   <summary>
   How to retest this PR or trigger a specific build:
   </summary>
   
   - for <b>pull request checks</b>  
     Please add comment: <b>Jenkins retest this</b>
   
   - for a <b>specific pull request check</b>  
     Please add comment: <b>Jenkins (re)run [kogito-runtimes|kogito-apps|kogito-examples] tests</b>
   
   - for <b>quarkus branch checks</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins run quarkus-branch</b>
   
   - for a <b>quarkus branch specific check</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins (re)run [kogito-runtimes|kogito-apps|kogito-examples] quarkus-branch</b>
   
   - for <b>quarkus main checks</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins run quarkus-main</b>
   
   - for a <b>specific quarkus main check</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins (re)run [kogito-runtimes|kogito-apps|kogito-examples] quarkus-main</b>
   
   - for <b>quarkus lts checks</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins run quarkus-lts</b>
   
   - for a <b>specific quarkus lts check</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins (re)run [kogito-runtimes|kogito-apps|kogito-examples] quarkus-lts</b>
   
   - for <b>native checks</b>  
     Run native checks  
     Please add comment: <b>Jenkins run native</b>
   
   - for a <b>specific native check</b>  
     Run native checks 
     Please add comment: <b>Jenkins (re)run [kogito-runtimes|kogito-apps|kogito-examples] native</b>
   
   - for <b>native lts checks</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins run native-lts</b>
   
   - for a <b>specific native lts check</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins (re)run [kogito-runtimes|kogito-apps|kogito-examples] native-lts</b>
   </details>
   
   <details>
   <summary>
   How to backport a pull request to a different branch?
   </summary>
   
   In order to automatically create a **backporting pull request** please add one or more labels having the following format `backport-<branch-name>`, where `<branch-name>` is the name of the branch where the pull request must be backported to (e.g., `backport-7.67.x` to backport the original PR to the `7.67.x` branch).
   
   > **NOTE**: **backporting** is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.
   
   Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
   
   If something goes wrong, the author will be notified and at this point a manual backporting is needed.
   
   > **NOTE**: this automated backporting is triggered whenever a pull request on `main` branch is labeled or closed, but both conditions must be satisfied to get the new PR created.
   </details>
   
   <details>
   <summary>
   Quarkus-3 PR check is failing ... what to do ?
   </summary>
   The Quarkus 3 check is applying patches from the `.ci/environments/quarkus-3/patches`.
   
   The first patch, called `0001_before_sh.patch`, is generated from Openrewrite `.ci/environments/quarkus-3/quarkus3.yml` recipe. The patch is created to speed up the check. But it may be that some changes in the PR broke this patch.  
   No panic, there is an easy way to regenerate it. You just need to comment on the PR:
   ```
   jenkins rewrite quarkus-3
   ```
   and it should, after some minutes (~20/30min) apply a commit on the PR with the patch regenerated.
   
   Other patches were generated manually. If any of it fails, you will need to manually update it... and push your changes.
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#issuecomment-1768986429

   
   **PR job** `#8` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   <details>
   <summary><b>Reproducer</b></summary>
   
   
   
   build-chain build full_downstream  -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252 --skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
   
   </details>
   
   
   Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3252/8/display/redirect
   
   **Test results:**
   - PASSED: 3263
   - FAILED: 1
   
   Those are the test failures: 
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3252/8/testReport/org.kie.kogito.addon.quarkus.messaging.common/QuarkusEventThreadPoolTest/testQuarkusEventThreadPoolMultiThreadLongQueueTest/">org.kie.kogito.addon.quarkus.messaging.common.QuarkusEventThreadPoolTest.testQuarkusEventThreadPoolMultiThreadLongQueueTest</a></summary>
   expected: not equal but was: <0>
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "nmirasch (via GitHub)" <gi...@apache.org>.
nmirasch commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1361733389


##########
api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2023 Red Hat, Inc. and/or its affiliates.

Review Comment:
   @tiagodolphine I think this header needs to be updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1390902725


##########
api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.services.registry;
+
+import java.util.List;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import org.kie.kogito.Application;
+import org.kie.kogito.event.EventBatch;
+import org.kie.kogito.event.impl.ProcessEventBatch;
+import org.kie.kogito.event.process.NodeDefinition;
+import org.kie.kogito.event.process.ProcessDefinitionDataEvent;
+import org.kie.kogito.event.process.ProcessDefinitionEventBody;
+import org.kie.kogito.internal.utils.ConversionUtils;
+import org.kie.kogito.process.Process;
+import org.kie.kogito.process.Processes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ProcessDefinitionEventRegistry {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ProcessDefinitionEventRegistry.class);
+
+    private Application app;
+    private String serviceUrl;
+
+    public ProcessDefinitionEventRegistry(Application app, String serviceUrl) {
+        this.app = app;
+        this.serviceUrl = serviceUrl;
+    }
+
+    public void register(Processes processes) {
+        EventBatch eventBatch = new ProcessEventBatch();
+        processes.processIds().stream()
+                .map(processes::processById)
+                .map(mapProcessDefinition(app.config().addons().availableAddons(), serviceUrl))
+                .forEach(process -> {
+                    LOGGER.debug("Registering process definition with id: {}", process.getId());
+                    eventBatch.append(process);
+                });
+        LOGGER.debug("Publishing all processes definitions");
+        app.unitOfWorkManager().eventManager().publish(eventBatch);
+    }
+
+    private Function<Process<?>, ProcessDefinitionDataEvent> mapProcessDefinition(Set<String> addons, String endpoint) {
+        return p -> new ProcessDefinitionDataEvent(ProcessDefinitionEventBody.builder()
+                .setId(p.id())
+                .setName(p.name())
+                .setVersion(p.version())
+                .setType(ProcessDefinitionDataEvent.PROCESS_DEFINITION_EVENT)
+                .setAddons(addons)
+                .setEndpoint(getEndpoint(endpoint, p))
+                .setSource(getProcessSource())
+                .setNodes(getNodesDefinitions(p))
+                .build());
+    }
+
+    private static String getEndpoint(String endpoint, Process<?> p) {
+        //sanitize process path in case of fqdn org.acme.ProcessExample -> ProcessExample
+        String processPath = ConversionUtils.sanitizeToSimpleName(p.id());
+        return endpoint + "/" + processPath;
+    }
+
+    private List<NodeDefinition> getNodesDefinitions(Process<?> p) {
+        return p.findNodes(n -> true).stream()
+                .map(node -> NodeDefinition.builder()
+                        .setId(String.valueOf(node.getId()))
+                        .setName(node.getName())
+                        .setType(node.getNodeType().name())
+                        .setUniqueId(node.getNodeUniqueId())
+                        .setMetadata(node.getMetaData())
+                        .build())
+                .collect(Collectors.toList());
+    }
+
+    private String getProcessSource() {
+        return null;

Review Comment:
   looks like getProcesssource it was removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "tiagodolphine (via GitHub)" <gi...@apache.org>.
tiagodolphine merged PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "nmirasch (via GitHub)" <gi...@apache.org>.
nmirasch commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1361738736


##########
api/kogito-events-core/src/main/java/org/kie/kogito/event/impl/ProcessEventBatch.java:
##########
@@ -0,0 +1,27 @@
+package org.kie.kogito.event.impl;

Review Comment:
   @tiagodolphine missing header



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "nmirasch (via GitHub)" <gi...@apache.org>.
nmirasch commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1361736562


##########
api/kogito-events-api/src/main/java/org/kie/kogito/event/process/NodeDefinitionEventBody.java:
##########
@@ -0,0 +1,83 @@
+package org.kie.kogito.event.process;

Review Comment:
   @tiagodolphine missing header



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1390899725


##########
springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java:
##########
@@ -53,6 +49,9 @@ public class KafkaEventPublisher implements EventPublisher {
     @Value("${kogito.events.processinstances.enabled:true}")
     private boolean processInstancesEvents;
 
+    @Value("${kogito.events.process-definition.enabled:true}")

Review Comment:
   @tiagodolphine just a reminder, I believe this renaming is pending.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "tiagodolphine (via GitHub)" <gi...@apache.org>.
tiagodolphine commented on PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#issuecomment-1823353635

   @nmirasch @wmedvede want to take another round of review? or are we ok to merge?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "tiagodolphine (via GitHub)" <gi...@apache.org>.
tiagodolphine commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1361953361


##########
api/kogito-events-api/src/main/java/org/kie/kogito/event/process/NodeDefinitionEventBody.java:
##########
@@ -0,0 +1,83 @@
+package org.kie.kogito.event.process;
+
+import java.util.Map;
+
+public class NodeDefinitionEventBody {

Review Comment:
   +1, indeed this is not an event body, so I'll rename it, thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "nmirasch (via GitHub)" <gi...@apache.org>.
nmirasch commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1361738141


##########
quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/src/main/java/org/kie/kogito/quarkus/registry/ProcessDefinitionRegistration.java:
##########
@@ -0,0 +1,31 @@
+package org.kie.kogito.quarkus.registry;

Review Comment:
   @tiagodolphine missing header



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#issuecomment-1771787512

   
   **PR job** `#11` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   <details>
   <summary><b>Reproducer</b></summary>
   
   
   
   build-chain build full_downstream  -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252 --skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
   
   </details>
   
   
   Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3252/11/display/redirect
   
   **Test results:**
   - PASSED: 3377
   - FAILED: 1
   
   Those are the test failures: 
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3252/11/testReport/org.kie.kogito.quarkus.workflows/PojoServiceIT/testPojo/">org.kie.kogito.quarkus.workflows.PojoServiceIT.testPojo</a></summary>
   <br/>Expected size: 1 but was: 2 in:<br/>{"age"=666, "name"="javieritoPerson"}
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#issuecomment-1821594613

   
   **PR job** `#23` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   <details>
   <summary><b>Reproducer</b></summary>
   
   
   
   build-chain build full_downstream  -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252 --skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
   
   </details>
   
   
   Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3252/23/display/redirect
   
   **Test results:**
   - PASSED: 3391
   - FAILED: 2
   
   Those are the test failures: 
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3252/23/testReport/org.kie.kogito.mongodb.transaction/AbstractTransactionManagerIT/testAbort/">org.kie.kogito.mongodb.transaction.AbstractTransactionManagerIT.testAbort</a></summary>
   Command failed with error 246 (SnapshotUnavailable): 'Unable to read from a snapshot due to pending collection catalog changes; please retry the operation. Snapshot timestamp is Timestamp(1700585679, 0). Collection minimum is Timestamp(1700585679, 2)' on server 172.17.0.1:34002. The full response is {"errorLabels": ["TransientTransactionError"], "operationTime": {"$timestamp": {"t": 1700585678, "i": 2}}, "ok": 0.0, "errmsg": "Unable to read from a snapshot due to pending collection catalog changes; please retry the operation. Snapshot timestamp is Timestamp(1700585679, 0). Collection minimum is Timestamp(1700585679, 2)", "code": 246, "codeName": "SnapshotUnavailable", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1700585680, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}}
   </details>
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3252/23/testReport/org.kie.kogito.quarkus.workflows/PojoServiceIT/testPojo/">org.kie.kogito.quarkus.workflows.PojoServiceIT.testPojo</a></summary>
   <br/>Expecting value to be true but was false
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1365152667


##########
springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java:
##########
@@ -53,6 +49,9 @@ public class KafkaEventPublisher implements EventPublisher {
     @Value("${kogito.events.processinstances.enabled:true}")
     private boolean processInstancesEvents;
 
+    @Value("${kogito.events.process-definition.enabled:true}")

Review Comment:
   same comment here regading the naming of this property



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1365159185


##########
api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.services.registry;
+
+import java.util.List;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import org.kie.kogito.Application;
+import org.kie.kogito.event.EventBatch;
+import org.kie.kogito.event.impl.ProcessEventBatch;
+import org.kie.kogito.event.process.NodeDefinition;
+import org.kie.kogito.event.process.ProcessDefinitionDataEvent;
+import org.kie.kogito.event.process.ProcessDefinitionEventBody;
+import org.kie.kogito.internal.utils.ConversionUtils;
+import org.kie.kogito.process.Process;
+import org.kie.kogito.process.Processes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ProcessDefinitionEventRegistry {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ProcessDefinitionEventRegistry.class);
+
+    private Application app;
+    private String serviceUrl;
+
+    public ProcessDefinitionEventRegistry(Application app, String serviceUrl) {
+        this.app = app;
+        this.serviceUrl = serviceUrl;
+    }
+
+    public void register(Processes processes) {
+        EventBatch eventBatch = new ProcessEventBatch();
+        processes.processIds().stream()
+                .map(processes::processById)
+                .map(mapProcessDefinition(app.config().addons().availableAddons(), serviceUrl))
+                .forEach(process -> {
+                    LOGGER.debug("Registering process definition with id: {}", process.getId());
+                    eventBatch.append(process);
+                });
+        LOGGER.debug("Publishing all processes definitions");
+        app.unitOfWorkManager().eventManager().publish(eventBatch);
+    }
+
+    private Function<Process<?>, ProcessDefinitionDataEvent> mapProcessDefinition(Set<String> addons, String endpoint) {
+        return p -> new ProcessDefinitionDataEvent(ProcessDefinitionEventBody.builder()
+                .setId(p.id())
+                .setName(p.name())
+                .setVersion(p.version())
+                .setType(ProcessDefinitionDataEvent.PROCESS_DEFINITION_EVENT)
+                .setAddons(addons)
+                .setEndpoint(getEndpoint(endpoint, p))
+                .setSource(getProcessSource())
+                .setNodes(getNodesDefinitions(p))
+                .build());
+    }
+
+    private static String getEndpoint(String endpoint, Process<?> p) {
+        //sanitize process path in case of fqdn org.acme.ProcessExample -> ProcessExample
+        String processPath = ConversionUtils.sanitizeToSimpleName(p.id());
+        return endpoint + "/" + processPath;
+    }
+
+    private List<NodeDefinition> getNodesDefinitions(Process<?> p) {
+        return p.findNodes(n -> true).stream()
+                .map(node -> NodeDefinition.builder()
+                        .setId(String.valueOf(node.getId()))
+                        .setName(node.getName())
+                        .setType(node.getNodeType().name())
+                        .setUniqueId(node.getNodeUniqueId())
+                        .setMetadata(node.getMetaData())
+                        .build())
+                .collect(Collectors.toList());
+    }
+
+    private String getProcessSource() {
+        return null;

Review Comment:
   This represents the .bpm/.yaml/.json with the process content? or the cloud event source?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1365072422


##########
quarkus/addons/events/process/runtime/src/main/java/org/kie/kogito/events/config/EventsRuntimeConfig.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.events.config;
+
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
+
+@ConfigRoot(name = "", phase = ConfigPhase.RUN_TIME, prefix = "kogito.events")
+public class EventsRuntimeConfig {
+
+    /**
+     * Enable publishing processes instances events
+     */
+    @ConfigItem(name = "processinstances.enabled", defaultValue = "true")
+    boolean processInstancesEventsEnabled;
+
+    /**
+     * Enable publishing processes definition events
+     */
+    @ConfigItem(name = "process-definition.enabled", defaultValue = "true")

Review Comment:
   nitpick comment, not blocker. But I believe that if the sibling events has names like "processinstances", "usertasks", maye for this new property we should follow the existing naming pattern and define; "processdefinitions" instead.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1365075091


##########
api/kogito-api/src/main/java/org/kie/kogito/event/EventPublisher.java:
##########
@@ -31,6 +31,11 @@
  */
 public interface EventPublisher {
 
+    String PI_TOPIC_NAME = "kogito-processinstances-events";
+    String UI_TOPIC_NAME = "kogito-usertaskinstances-events";
+    String VI_TOPIC_NAME = "kogito-variables-events";
+    String PD_TOPIC_NAME = "kogito-process-definition-events";

Review Comment:
   see my comments below regarding the naming of this new property, not a blocker, but I believe the new topic name should be kogito-processdefinitions-events instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "tiagodolphine (via GitHub)" <gi...@apache.org>.
tiagodolphine commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1390998084


##########
springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java:
##########
@@ -53,6 +49,9 @@ public class KafkaEventPublisher implements EventPublisher {
     @Value("${kogito.events.processinstances.enabled:true}")
     private boolean processInstancesEvents;
 
+    @Value("${kogito.events.process-definition.enabled:true}")

Review Comment:
   I missed this one, thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "jstastny-cz (via GitHub)" <gi...@apache.org>.
jstastny-cz commented on PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#issuecomment-1767852042

   Jenkins failed with
   ```
   [ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.13.0:validate (default) on project kogito-codegen-api: File '/home/jenkins/jenkins-agent/workspace/_jobs_kogito-runtimes-pr_PR-3252/kogito-pipelines/bc/apache_incubator-kie-kogito-runtimes/kogito-codegen-modules/kogito-codegen-api/src/main/java/org/kie/kogito/codegen/api/context/impl/SpringBootKogitoBuildContext.java' has not been previously formatted.  Please format file and commit before running validation! -> [Help 1]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "nmirasch (via GitHub)" <gi...@apache.org>.
nmirasch commented on code in PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#discussion_r1361940147


##########
api/kogito-events-api/src/main/java/org/kie/kogito/event/process/NodeDefinitionEventBody.java:
##########
@@ -0,0 +1,83 @@
+package org.kie.kogito.event.process;
+
+import java.util.Map;
+
+public class NodeDefinitionEventBody {

Review Comment:
   @tiagodolphine regarding this is just a POJO and it is nott specifically the body of any event, I think it makes sense rename this class just to NodeDefinition, ProcessDefinitionNode.. or something similar. WDYT? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KOGITO-9886] Add the support for the ProcessDefinitionDataEvent at runtime [incubator-kie-kogito-runtimes]

Posted by "ricardozanini (via GitHub)" <gi...@apache.org>.
ricardozanini commented on PR #3252:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3252#issuecomment-1765136105

   FYI the GHA is running now, these errors are related to the test itself.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org