tiagodolphine commented on code in PR #1941:
URL:
https://github.com/apache/incubator-kie-kogito-apps/pull/1941#discussion_r1445325506
##########
data-index/data-index-common/src/main/java/org/kie/kogito/index/service/IndexingService.java:
##########
@@ -66,76 +72,57 @@ public class IndexingService {
@Inject
DataIndexStorageService manager;
- @Inject
- Instance<ProcessInstanceEventMerger> processInstanceMergers;
-
- @Inject
- Instance<UserTaskInstanceEventMerger> userTaskInstanceMergers;
-
- @Inject
- ProcessDefinitionEventMerger processDefinitionEventMerger;
-
//retry in case of rare but possible race condition during the insert for
the first registry
@Retry(maxRetries = 3, delay = 300, jitter = 100, retryOn =
ConcurrentModificationException.class)
public void indexProcessInstanceEvent(ProcessInstanceDataEvent<?> event) {
- handleProcessInstanceEvent(event);
- }
-
- private ProcessInstance
handleProcessInstanceEvent(ProcessInstanceDataEvent<?> event) {
- Optional<ProcessInstance> found =
Optional.ofNullable(manager.getProcessInstancesCache().get(event.getKogitoProcessInstanceId()));
- ProcessInstance pi;
- if (found.isEmpty()) {
- pi = new ProcessInstance();
- pi.setId(event.getKogitoProcessInstanceId());
- pi.setProcessId(event.getKogitoProcessId());
- pi.setMilestones(new ArrayList<>());
- pi.setNodes(new ArrayList<>());
- } else {
- pi = found.get();
-
+ ProcessInstanceStorage storage = manager.getProcessInstanceStorage();
Review Comment:
what about adding a generic `index` method in the ProcessInstanceStorage
that does this check about the event type and calls the proper method
internally to index each type of event.
##########
data-index/data-index-storage/data-index-storage-api/pom.xml:
##########
@@ -49,6 +49,10 @@
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.kie.kogito</groupId>
+ <artifactId>kogito-events-core</artifactId>
Review Comment:
isn't kogito-events-api enough or do we need the core?
##########
data-index/data-index-storage/data-index-storage-oracle/src/main/resources/META-INF/orm.xml:
##########
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
Review Comment:
can this be done with java class + annotations?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]