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

[PR] Changes to make counters dynamic [incubator-kie-tools]

bncriju opened a new pull request, #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781

   The wrong behavior is rectified by making the Process Instances, Tasks and Jobs to get dynamically updated, as and when user defines a process instance.


-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "danielzhe (via GitHub)" <gi...@apache.org>.
danielzhe commented on PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#issuecomment-2532591934

   I fixed the broken build locally and published here: https://github.com/danielzhe/kie-tools/commit/329e23ed0d0554c96a9cc58c500f7cab755cc874
   
   The fix that I made it was just to make it buildable, I don't know if the code this way is your intention,  because of the use of `@IfBuildProfile("dev")` that I had to remove to satisfy the injection point. @bncriju 


-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "bncriju (via GitHub)" <gi...@apache.org>.
bncriju commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1888972826


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevuiJsonRPCService.java:
##########
@@ -84,24 +99,43 @@ protected WebClientOptions buildWebClientOptions(String dataIndexURL) throws Mal
                 .setSsl(url.getProtocol().compareToIgnoreCase("https") == 0);
     }
 
-    public Uni<String> queryProcessInstancesCount() {
-        return doQuery(ALL_PROCESS_INSTANCES_IDS_QUERY, PROCESS_INSTANCES);
+    public Multi<String> queryProcessInstancesCount() {
+        return processesStream;
+    }
+
+    public Multi<String> queryTasksCount() {
+        return userTaskStream;
     }
 
-    public Uni<String> queryTasksCount() {
-        return doQuery(ALL_TASKS_IDS_QUERY, USER_TASKS);
+    public Multi<String> queryJobsCount() {
+        return jobsStreams;
+    }
+
+    private void onProcessEvent() {
+        doQuery(processesStream, ALL_PROCESS_INSTANCES_IDS_QUERY, PROCESS_INSTANCES);
+    }
+    private void onUserTaskEvent() {
+        doQuery(userTaskStream, ALL_TASKS_IDS_QUERY, USER_TASKS);
+    }
+    private void onJobEvent() {
+        doQuery(jobsStreams, ALL_JOBS_IDS_QUERY, JOBS);
     }
 
-    public Uni<String> queryJobsCount() {
-        return doQuery(ALL_JOBS_IDS_QUERY, JOBS);
+    private void doQuery(BroadcastProcessor<String> stream, String query, String graphModelName) {
+        LOGGER.warn("Query: " + graphModelName);
+        doQuery(query, graphModelName).toCompletionStage()
+                .thenAccept(result -> {
+            LOGGER.warn("Query: " + graphModelName + ". Received response: " + result);
+            stream.onNext(result);

Review Comment:
   Done. Incorporated in new PR



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "danielzhe (via GitHub)" <gi...@apache.org>.
danielzhe commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1878641063


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/DataIndexCounter.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+
+import io.smallrye.mutiny.Multi;
+import io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor;
+import io.vertx.core.Future;
+import io.vertx.core.Vertx;
+import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.client.WebClient;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@ApplicationScoped
+public class DataIndexCounter {
+    private static final String DATA_INDEX_URL = "kogito.data-index.url";
+    private static final Logger LOGGER = LoggerFactory.getLogger(DataIndexCounter.class);
+
+    private Multi<String> multi;
+    private WebClient dataIndexWebClient;
+
+    public DataIndexCounter(String query, String graphname, BroadcastProcessor<String> stream,WebClient dataIndexWebClient, JBPMDevUIEventPublisher eventPublisher) {

Review Comment:
   The `JBPMDevUIEventPublisher eventPublisher` is not being used anywhere here.
   
   Also, you can format the parameters with a space between each one:
   `String query, String graphname, BroadcastProcessor<String> stream, WebClient dataIndexWebClient`
   (the `stream,WebClient` are merged)
   
   



##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/DataIndexCounter.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+
+import io.smallrye.mutiny.Multi;
+import io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor;
+import io.vertx.core.Future;
+import io.vertx.core.Vertx;
+import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.client.WebClient;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@ApplicationScoped
+public class DataIndexCounter {
+    private static final String DATA_INDEX_URL = "kogito.data-index.url";
+    private static final Logger LOGGER = LoggerFactory.getLogger(DataIndexCounter.class);
+
+    private Multi<String> multi;
+    private WebClient dataIndexWebClient;

Review Comment:
   You can set those fields as `final`, since their instances are not changed.



-- 
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] Changes to make counters dynamic [incubator-kie-tools]

Posted by "jomarko (via GitHub)" <gi...@apache.org>.
jomarko commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1865716645


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevUIEventPublisher.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.kie.kogito.event.DataEvent;
+import org.kie.kogito.event.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collection;
+import java.util.Objects;
+
+@ApplicationScoped
+public class JBPMDevUIEventPublisher implements EventPublisher {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(JBPMDevUIEventPublisher.class);
+    private Runnable onProcessEvent;
+    private Runnable onTaskEvent;
+    private Runnable onJobEvent;
+
+    @Override
+    public void publish(DataEvent<?> event) {
+        switch (event.getType()) {
+            case "ProcessInstanceStateDataEvent":
+                maybeRun(onProcessEvent);
+                break;
+            case "UserTaskInstanceStateDataEvent":
+                maybeRun(onTaskEvent);
+                break;
+            case "JobEvent":
+                maybeRun(onJobEvent);
+                break;
+            default:
+                LOGGER.debug("Unknown type of event '{}', ignoring for this publisher", event.getType());
+        }
+    }
+
+    @Override
+    public void publish(Collection<DataEvent<?>> events) {
+        events.forEach(this::publish);
+    }
+
+    private void maybeRun(Runnable runnable) {
+        if(Objects.nonNull(runnable)) {

Review Comment:
   @tiagobento hi, does `Prettier` format only non java files? I would expect `if () {` instead of `if() {`



##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevuiJsonRPCService.java:
##########
@@ -84,24 +99,43 @@ protected WebClientOptions buildWebClientOptions(String dataIndexURL) throws Mal
                 .setSsl(url.getProtocol().compareToIgnoreCase("https") == 0);
     }
 
-    public Uni<String> queryProcessInstancesCount() {
-        return doQuery(ALL_PROCESS_INSTANCES_IDS_QUERY, PROCESS_INSTANCES);
+    public Multi<String> queryProcessInstancesCount() {
+        return processesStream;
+    }
+
+    public Multi<String> queryTasksCount() {
+        return userTaskStream;
     }
 
-    public Uni<String> queryTasksCount() {
-        return doQuery(ALL_TASKS_IDS_QUERY, USER_TASKS);
+    public Multi<String> queryJobsCount() {
+        return jobsStreams;
+    }
+
+    private void onProcessEvent() {
+        doQuery(processesStream, ALL_PROCESS_INSTANCES_IDS_QUERY, PROCESS_INSTANCES);
+    }
+    private void onUserTaskEvent() {
+        doQuery(userTaskStream, ALL_TASKS_IDS_QUERY, USER_TASKS);
+    }
+    private void onJobEvent() {
+        doQuery(jobsStreams, ALL_JOBS_IDS_QUERY, JOBS);
     }
 
-    public Uni<String> queryJobsCount() {
-        return doQuery(ALL_JOBS_IDS_QUERY, JOBS);
+    private void doQuery(BroadcastProcessor<String> stream, String query, String graphModelName) {
+        LOGGER.warn("Query: " + graphModelName);
+        doQuery(query, graphModelName).toCompletionStage()
+                .thenAccept(result -> {
+            LOGGER.warn("Query: " + graphModelName + ". Received response: " + result);
+            stream.onNext(result);

Review Comment:
   is the `warning` level needed here? sounds like good event for `info` or `debug`, but I am not sure, maybe there is good reason to have `warn`



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "bncriju (via GitHub)" <gi...@apache.org>.
bncriju closed pull request #2781: kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items
URL: https://github.com/apache/incubator-kie-tools/pull/2781


-- 
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] Changes to make counters dynamic [incubator-kie-tools]

Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1866151621


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevUIEventPublisher.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.kie.kogito.event.DataEvent;
+import org.kie.kogito.event.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collection;
+import java.util.Objects;
+
+@ApplicationScoped

Review Comment:
   Please add the IfBuildProfile("dev") here, to make sure that this bean is only available in dev mode!



##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevUIEventPublisher.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.kie.kogito.event.DataEvent;
+import org.kie.kogito.event.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collection;
+import java.util.Objects;
+
+@ApplicationScoped

Review Comment:
   Please add the @IfBuildProfile("dev") here, to make sure that this bean is only available in dev mode!



-- 
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] Changes to make counters dynamic [incubator-kie-tools]

Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1866165300


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevuiJsonRPCService.java:
##########
@@ -41,6 +44,10 @@
 public class JBPMDevuiJsonRPCService {
     private static final String DATA_INDEX_URL = "kogito.data-index.url";
 
+    private final BroadcastProcessor<String> processesStream = BroadcastProcessor.create();

Review Comment:
   I think we said to move this to `Multi`, since the `BroadcastProcessor` don't cache values, or have an intermediate bean that acts as a values producer for the `Multi`



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "bncriju (via GitHub)" <gi...@apache.org>.
bncriju commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1888985289


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/DataIndexCounter.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+
+import io.smallrye.mutiny.Multi;
+import io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor;
+import io.vertx.core.Future;
+import io.vertx.core.Vertx;
+import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.client.WebClient;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@ApplicationScoped
+public class DataIndexCounter {
+    private static final String DATA_INDEX_URL = "kogito.data-index.url";
+    private static final Logger LOGGER = LoggerFactory.getLogger(DataIndexCounter.class);
+
+    private Multi<String> multi;
+    private WebClient dataIndexWebClient;

Review Comment:
   Done. Incorporated in new PR



-- 
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] Changes to make counters dynamic [incubator-kie-tools]

Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1866152384


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevUIEventPublisher.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.kie.kogito.event.DataEvent;
+import org.kie.kogito.event.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collection;
+import java.util.Objects;
+
+@ApplicationScoped

Review Comment:
   https://es.quarkus.io/guides/cdi-reference#enable_build_profile



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "bncriju (via GitHub)" <gi...@apache.org>.
bncriju commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1888973214


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevUIEventPublisher.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.kie.kogito.event.DataEvent;
+import org.kie.kogito.event.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collection;
+import java.util.Objects;
+
+@ApplicationScoped
+public class JBPMDevUIEventPublisher implements EventPublisher {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(JBPMDevUIEventPublisher.class);
+    private Runnable onProcessEvent;
+    private Runnable onTaskEvent;
+    private Runnable onJobEvent;
+
+    @Override
+    public void publish(DataEvent<?> event) {
+        switch (event.getType()) {
+            case "ProcessInstanceStateDataEvent":
+                maybeRun(onProcessEvent);
+                break;
+            case "UserTaskInstanceStateDataEvent":
+                maybeRun(onTaskEvent);
+                break;
+            case "JobEvent":
+                maybeRun(onJobEvent);
+                break;
+            default:
+                LOGGER.debug("Unknown type of event '{}', ignoring for this publisher", event.getType());
+        }
+    }
+
+    @Override
+    public void publish(Collection<DataEvent<?>> events) {
+        events.forEach(this::publish);
+    }
+
+    private void maybeRun(Runnable runnable) {
+        if(Objects.nonNull(runnable)) {

Review Comment:
   Done. Incorporated in new PR



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "bncriju (via GitHub)" <gi...@apache.org>.
bncriju commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1888973456


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevUIEventPublisher.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.kie.kogito.event.DataEvent;
+import org.kie.kogito.event.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collection;
+import java.util.Objects;
+
+@ApplicationScoped

Review Comment:
   Done. Incorporated in new PR



##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevuiJsonRPCService.java:
##########
@@ -41,6 +44,10 @@
 public class JBPMDevuiJsonRPCService {
     private static final String DATA_INDEX_URL = "kogito.data-index.url";
 
+    private final BroadcastProcessor<String> processesStream = BroadcastProcessor.create();

Review Comment:
   Done. Incorporated in new PR



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "danielzhe (via GitHub)" <gi...@apache.org>.
danielzhe commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1878638682


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevUIEventPublisher.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.kie.kogito.event.DataEvent;
+import org.kie.kogito.event.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collection;
+import java.util.Objects;
+
+@ApplicationScoped

Review Comment:
   This broke the build, @pefernan . Maybe more changes need to be made or it need to have a prod bean? I don't know.



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "bncriju (via GitHub)" <gi...@apache.org>.
bncriju commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1888973924


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/DataIndexCounter.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.jbpm.quarkus.devui.runtime.rpc;
+
+import io.smallrye.mutiny.Multi;
+import io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor;
+import io.vertx.core.Future;
+import io.vertx.core.Vertx;
+import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.client.WebClient;
+import jakarta.enterprise.context.ApplicationScoped;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@ApplicationScoped
+public class DataIndexCounter {
+    private static final String DATA_INDEX_URL = "kogito.data-index.url";
+    private static final Logger LOGGER = LoggerFactory.getLogger(DataIndexCounter.class);
+
+    private Multi<String> multi;
+    private WebClient dataIndexWebClient;
+
+    public DataIndexCounter(String query, String graphname, BroadcastProcessor<String> stream,WebClient dataIndexWebClient, JBPMDevUIEventPublisher eventPublisher) {

Review Comment:
   Done. Incorporated in new PR



-- 
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] kie-issues#1669: jBPM Quarkus DevUI seems to not update the # of items [incubator-kie-tools]

Posted by "bncriju (via GitHub)" <gi...@apache.org>.
bncriju commented on PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#issuecomment-2549218341

   Thanks for comments on this PR. All of those are incorporated in new PR https://github.com/apache/incubator-kie-tools/pull/2814 after renaming of the branch to match the right kie-issue


-- 
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] Changes to make counters dynamic [incubator-kie-tools]

Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #2781:
URL: https://github.com/apache/incubator-kie-tools/pull/2781#discussion_r1866154379


##########
packages/jbpm-quarkus-devui/jbpm-quarkus-devui-runtime/src/main/java/org/jbpm/quarkus/devui/runtime/rpc/JBPMDevuiJsonRPCService.java:
##########
@@ -84,24 +99,43 @@ protected WebClientOptions buildWebClientOptions(String dataIndexURL) throws Mal
                 .setSsl(url.getProtocol().compareToIgnoreCase("https") == 0);
     }
 
-    public Uni<String> queryProcessInstancesCount() {
-        return doQuery(ALL_PROCESS_INSTANCES_IDS_QUERY, PROCESS_INSTANCES);
+    public Multi<String> queryProcessInstancesCount() {
+        return processesStream;
+    }
+
+    public Multi<String> queryTasksCount() {
+        return userTaskStream;
     }
 
-    public Uni<String> queryTasksCount() {
-        return doQuery(ALL_TASKS_IDS_QUERY, USER_TASKS);
+    public Multi<String> queryJobsCount() {
+        return jobsStreams;
+    }
+
+    private void onProcessEvent() {
+        doQuery(processesStream, ALL_PROCESS_INSTANCES_IDS_QUERY, PROCESS_INSTANCES);
+    }
+    private void onUserTaskEvent() {
+        doQuery(userTaskStream, ALL_TASKS_IDS_QUERY, USER_TASKS);
+    }
+    private void onJobEvent() {
+        doQuery(jobsStreams, ALL_JOBS_IDS_QUERY, JOBS);
     }
 
-    public Uni<String> queryJobsCount() {
-        return doQuery(ALL_JOBS_IDS_QUERY, JOBS);
+    private void doQuery(BroadcastProcessor<String> stream, String query, String graphModelName) {
+        LOGGER.warn("Query: " + graphModelName);
+        doQuery(query, graphModelName).toCompletionStage()
+                .thenAccept(result -> {
+            LOGGER.warn("Query: " + graphModelName + ". Received response: " + result);
+            stream.onNext(result);

Review Comment:
   yea I'd remove this to avoid verbosity. Only log if there's an error on the query.



-- 
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