Skip to content

Commit

Permalink
incubator-kie-issues#1283: Fix Kogito Addons Quarkus Data Index `DevM…
Browse files Browse the repository at this point in the history
…ode`

- Fix extensions capabilities names in order to make Kogito Runtime able to check them.
- Make Data Index Addons generate a default `kogito.data-index.url` in `DevMode`
  • Loading branch information
pefernan committed May 30, 2024
1 parent cde6132 commit cc986a9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
<capabilities>
<provides>org.kie.kogito.data-index.persistence.infinispan</provides>
<provides>org.kie.kogito.data-index.persistence</provides>
</capabilities>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
<capabilities>
<provides>org.kie.kogito.data-index.persistence.mongodb</provides>
<provides>org.kie.kogito.data-index.persistence</provides>
</capabilities>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.kie.kogito.addons.quarkus.data.index.deployment;

import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.jandex.DotName;
import org.jboss.jandex.Type;
import org.kie.kogito.index.addon.vertx.VertxGraphiQLSetup;
Expand All @@ -33,16 +34,30 @@
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;

public abstract class AbstractKogitoAddonsQuarkusDataIndexProcessor extends OneOfCapabilityKogitoAddOnProcessor {
private static final String QUARKUS_HTTP_PORT = "quarkus.http.port";
private static final String KOGITO_SERVICE_URL_PROP = "kogito.service.url";
private static final String KOGITO_DATA_INDEX_PROP = "kogito.data-index.url";

AbstractKogitoAddonsQuarkusDataIndexProcessor() {
super(KogitoCapability.SERVERLESS_WORKFLOW, KogitoCapability.PROCESSES);
}

@BuildStep(onlyIf = IsDevelopment.class)
public void buildDefaultDataIndexURLSystemProperty(BuildProducer<SystemPropertyBuildItem> systemProperties) {
// Setting a default `kogito.data-index.url` accordingly to the runtime url.
String dataIndexUrl = ConfigProvider.getConfig().getOptionalValue(KOGITO_SERVICE_URL_PROP, String.class).orElseGet(() -> {
Integer port = ConfigProvider.getConfig().getOptionalValue(QUARKUS_HTTP_PORT, Integer.class).orElse(8080);
return "http://localhost:" + port;
});
systemProperties.produce(new SystemPropertyBuildItem(KOGITO_DATA_INDEX_PROP, dataIndexUrl));
}

@BuildStep(onlyIf = IsDevelopment.class)
public void processGraphiql(BuildProducer<AdditionalBeanBuildItem> additionalBean) {
additionalBean.produce(AdditionalBeanBuildItem.builder().addBeanClass(VertxGraphiQLSetup.class).setUnremovable().setDefaultScope(DotNames.APPLICATION_SCOPED).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
<capabilities>
<provides>org.kie.kogito.data-index.infinispan</provides>
<provides>org.kie.kogito.data-index</provides>
</capabilities>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
<capabilities>
<provides>org.kie.kogito.data-index.in-memory</provides>
<provides>org.kie.kogito.data-index</provides>
</capabilities>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
<capabilities>
<provides>org.kie.kogito.data-index.mongodb</provides>
<provides>org.kie.kogito.data-index</provides>
</capabilities>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
<capabilities>
<provides>org.kie.kogito.data-index.postgresql</provides>
<provides>org.kie.kogito.data-index</provides>
</capabilities>
</configuration>
</execution>
Expand Down

0 comments on commit cc986a9

Please sign in to comment.