You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ji...@apache.org on 2024/03/14 14:02:30 UTC
(camel-quarkus) 02/26: Fix catalog JSON resolution in native mode
This is an automated email from the ASF dual-hosted git repository.
jiriondrusek pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 86544d1ea548e925c14d72d520dad33467e6c363
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Mar 8 08:48:10 2024 +0000
Fix catalog JSON resolution in native mode
---
docs/modules/ROOT/pages/reference/extensions/core.adoc | 8 ++++++++
.../quarkus/core/deployment/CamelNativeImageProcessor.java | 7 ++++++-
.../main/java/org/apache/camel/quarkus/core/CamelConfig.java | 11 +++++++++++
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/core.adoc b/docs/modules/ROOT/pages/reference/extensions/core.adoc
index 014d098b7d..4ca4a1b84c 100644
--- a/docs/modules/ROOT/pages/reference/extensions/core.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/core.adoc
@@ -208,6 +208,14 @@ Setting this to `false` helps to reduce the size of the native image. In JVM mod
| `boolean`
| `true`
+|icon:lock[title=Fixed at build time] [[quarkus.camel.runtime-catalog.transformers]]`link:#quarkus.camel.runtime-catalog.transformers[quarkus.camel.runtime-catalog.transformers]`
+
+If `true` the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel transformers available in the application; otherwise transformer JSON schemas will not be available in the Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.
+
+Setting this to `false` helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to `false` except for making the behavior consistent with native mode.
+| `boolean`
+| `true`
+
|icon:lock[title=Fixed at build time] [[quarkus.camel.routes-discovery.enabled]]`link:#quarkus.camel.routes-discovery.enabled[quarkus.camel.routes-discovery.enabled]`
Enable automatic discovery of routes during static initialization.
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
index 3319d86b62..4711587b18 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
@@ -44,6 +44,7 @@ import org.apache.camel.TypeConverter;
import org.apache.camel.impl.engine.DefaultComponentResolver;
import org.apache.camel.impl.engine.DefaultDataFormatResolver;
import org.apache.camel.impl.engine.DefaultLanguageResolver;
+import org.apache.camel.impl.engine.DefaultTransformerResolver;
import org.apache.camel.quarkus.core.CamelConfig;
import org.apache.camel.quarkus.core.CamelConfig.ReflectionConfig;
import org.apache.camel.quarkus.core.CamelConfigFlags;
@@ -179,7 +180,7 @@ public class CamelNativeImageProcessor {
.forEach(service -> {
String packageName = getPackageName(service.type);
- String jsonPath = String.format("%s/%s.json", packageName.replace('.', '/'), service.name);
+ String jsonPath = String.format("META-INF/%s/%s.json", packageName.replace('.', '/'), service.name);
if (config.runtimeCatalog.components
&& service.path.startsWith(DefaultComponentResolver.RESOURCE_PATH)) {
@@ -193,6 +194,10 @@ public class CamelNativeImageProcessor {
&& service.path.startsWith(DefaultLanguageResolver.LANGUAGE_RESOURCE_PATH)) {
resources.add(new NativeImageResourceBuildItem(jsonPath));
}
+ if (config.runtimeCatalog.transformers
+ && service.path.startsWith(DefaultTransformerResolver.DATA_TYPE_TRANSFORMER_RESOURCE_PATH)) {
+ resources.add(new NativeImageResourceBuildItem(jsonPath));
+ }
});
if (config.runtimeCatalog.models) {
diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java
index a03ca09958..7ba39b5430 100644
--- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java
+++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java
@@ -339,6 +339,17 @@ public class CamelConfig {
*/
@ConfigItem(defaultValue = "true")
public boolean models;
+
+ /**
+ * If {@code true} the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel
+ * transformers available in the application; otherwise transformer JSON schemas will not be available in the
+ * Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.
+ * <p>
+ * Setting this to {@code false} helps to reduce the size of the native image. In JVM mode, there is no real
+ * benefit of setting this flag to {@code false} except for making the behavior consistent with native mode.
+ */
+ @ConfigItem(defaultValue = "true")
+ public boolean transformers;
}
/**