Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incubator-kie-issues#1283: Fix Kogito Addons Quarkus Data Index DevMode #2068

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading