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

Upgrade Camel to 4.10.0 #6986

Merged
merged 3 commits into from
Feb 11, 2025
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
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ asciidoc:
requires: "'util=camel-website-util,quarkus=xref:js/quarkus.js'"

# Project versions
camel-version: 4.9.0 # replace ${camel.version}
camel-version: 4.10.0 # replace ${camel.version}
camel-docs-version: next
camel-quarkus-version: 3.19.0 # replace ${camel-quarkus.version}
quarkus-version: 3.18.0 # replace ${quarkus.version}
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/examples/components/smb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ cqJvmSince: 3.7.0
cqNativeSince: 3.7.0
cqCamelPartName: smb
cqCamelPartTitle: SMB
cqCamelPartDescription: Receive files from SMB (Server Message Block) shares.
cqCamelPartDescription: Read and write files to Server Message Block (SMB) file shares.
cqExtensionPageTitle: SMB
2 changes: 1 addition & 1 deletion docs/modules/ROOT/examples/others/dsl-modeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cqArtifactId: camel-quarkus-dsl-modeline
cqArtifactIdBase: dsl-modeline
cqNativeSupported: false
cqStatus: Preview
cqDeprecated: false
cqDeprecated: true
cqJvmSince: 2.14.0
cqNativeSince: n/a
cqCamelPartName: dsl-modeline
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/examples/others/observability-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cqArtifactIdBase: observability-services
cqNativeSupported: true
cqStatus: Stable
cqDeprecated: false
cqJvmSince: 3.18.0
cqNativeSince: 3.18.0
cqJvmSince: 3.19.0
cqNativeSince: 3.19.0
cqCamelPartName: observability-services
cqCamelPartTitle: Observability Services
cqCamelPartDescription: Camel Observability Services
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/examples/others/openapi-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ cqJvmSince: 1.0.0
cqNativeSince: 1.0.0
cqCamelPartName: openapi-java
cqCamelPartTitle: Openapi Java
cqCamelPartDescription: Rest-dsl support for using openapi doc
cqCamelPartDescription: Rest DSL support for using OpenApi doc
cqExtensionPageTitle: OpenAPI Java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
:cq-artifact-id: camel-quarkus-dsl-modeline
:cq-native-supported: false
:cq-status: Preview
:cq-status-deprecation: Preview
:cq-status-deprecation: Preview Deprecated
:cq-description: Support for Camel K style modeline
:cq-deprecated: false
:cq-deprecated: true
:cq-jvm-since: 2.14.0
:cq-native-since: n/a

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##2.14.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
[.badge-key]##JVM since##[.badge-supported]##2.14.0## [.badge-key]##Native##[.badge-unsupported]##unsupported## [.badge-key]##⚠️##[.badge-unsupported]##Deprecated##
endif::[]

Support for Camel K style modeline
Expand Down
8 changes: 8 additions & 0 deletions docs/modules/ROOT/pages/reference/extensions/micrometer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ Set whether to enable the MicrometerExchangeEventNotifier for capturing metrics
| `boolean`
| `true`

|icon:lock[title=Fixed at build time] [[quarkus.camel.metrics.base-endpoint-uri-exchange-event-notifier]]`link:#quarkus.camel.metrics.base-endpoint-uri-exchange-event-notifier[quarkus.camel.metrics.base-endpoint-uri-exchange-event-notifier]`

Whether to use static or dynamic values for Endpoint Name tags in captured metrics. By default, static values are
used. When using dynamic tags, then a dynamic to (toD) can compute many different endpoint URIs that,
can lead to many tags as the URI is dynamic, so use this with care if setting this option to false.
| `boolean`
| `true`

|icon:lock[title=Fixed at build time] [[quarkus.camel.metrics.enable-route-event-notifier]]`link:#quarkus.camel.metrics.enable-route-event-notifier[quarkus.camel.metrics.enable-route-event-notifier]`

Set whether to enable the MicrometerRouteEventNotifier for capturing metrics on the total number of routes and total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ endif::[]

Camel Observability Services

[id="extensions-observability-services-whats-inside"]
== What's inside

* xref:{cq-camel-components}:others:observability-services.adoc[Observability Services]

Please refer to the above link for usage and configuration details.

[id="extensions-observability-services-maven-coordinates"]
== Maven coordinates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -118,8 +117,8 @@ protected CamelContext createCamelContext() {
throw new IllegalStateException("Should not be invoked");
}

public Collection<MainListener> getMainListeners() {
return Collections.unmodifiableCollection(listeners);
public List<MainListener> getMainListeners() {
return Collections.unmodifiableList(listeners);
}

public MainConfigurationProperties getMainConfigurationProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ metadata:
- "integration"
status:
- "preview"
- "deprecated"
15 changes: 15 additions & 0 deletions extensions/cassandraql/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@
<dependency>
<groupId>com.datastax.oss.quarkus</groupId>
<artifactId>cassandra-quarkus-client</artifactId>
<exclusions>
<exclusion>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.stephenc.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- TODO: https://github.com/datastax/cassandra-quarkus/issues/245 -->
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-query-builder</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@
import com.ibm.as400.access.NLSImplNative;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.NativeImageEnableAllCharsetsBuildItem;
import io.quarkus.deployment.builditem.*;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
import io.quarkus.gizmo.Gizmo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
import org.jboss.logging.Logger;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

class Jt400Processor {

Expand Down Expand Up @@ -105,4 +106,62 @@ IndexDependencyBuildItem registerDependencyForIndex() {
return new IndexDependencyBuildItem("net.sf.jt400", "jt400", "java11");
}

@BuildStep
BytecodeTransformerBuildItem patchToolboxSignonHandler() {
return new BytecodeTransformerBuildItem.Builder()
.setClassToTransform("com.ibm.as400.access.ToolboxSignonHandler")
.setCacheable(true)
.setVisitorFunction((className, classVisitor) -> new ToolboxSignonHandlerClassVisitor(classVisitor)).build();
}

/**
* ToolboxSignonHandler starts GUI dialogues from several methods. This is not supported in the native.
* Unfortunately the method AS400.isGuiAvailable does not disable every call to dialogue.
* Two methods `handleSignon` and `handlePasswordChange` has to be removed (they does not contain any logic,
* just the GUI interaction)
*
* ToolboxSignonHandler is a final class, therefore no substitutions can be added to this class
* and bytecode manipulation had to be used instead.
*/
static class ToolboxSignonHandlerClassVisitor extends ClassVisitor {

private final Logger logger;

protected ToolboxSignonHandlerClassVisitor(ClassVisitor classVisitor) {
super(Gizmo.ASM_API_VERSION, classVisitor);

logger = Logger.getLogger("ToolboxSignonHandlerClassVisitor");
}

@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature,
String[] exceptions) {
MethodVisitor original = super.visitMethod(access, name, descriptor, signature, exceptions);
if ("handleSignon".equals(name) || "handlePasswordChange".equals(name)) {
logger.debug("GUI interaction enhancer for Quarkus: transforming " + name + " to avoid spawning dialogues");
// Replace the method body
return new MethodVisitor(Gizmo.ASM_API_VERSION, original) {
@Override
public void visitCode() {
super.visitCode();
// Load 'true' or `false` onto the stack and return
if ("handlePasswordChange".equals(name)) {
visitInsn(Opcodes.ICONST_0); // push false
} else {
visitInsn(Opcodes.ICONST_1); // push true
}
visitInsn(Opcodes.IRETURN); // return boolean from the method
}

@Override
public void visitMaxs(int maxStack, int maxLocals) {
// Max stack is 1 (for the boolean), locals can remain unchanged
super.visitMaxs(1, 0);
}
};
}
return original;
}
}

}
Original file line number Diff line number Diff line change
@@ -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.apache.camel.quarkus.component.micrometer.deployment;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Optional;
import java.util.Properties;

import io.quarkus.test.QuarkusUnitTest;
import jakarta.inject.Inject;
import org.apache.camel.CamelContext;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier;
import org.apache.camel.spi.EventNotifier;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class MicrometerBaseEndpointUriExchangeEventNotifierDisableTest {
@RegisterExtension
static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addAsResource(applicationProperties(), "application.properties"));

@Inject
CamelContext context;

@Test
public void testBaseEndpointURIDisabled() {
Optional<EventNotifier> optionalExchangeEventNotifier = context.getManagementStrategy()
.getEventNotifiers()
.stream()
.filter(eventNotifier -> eventNotifier.getClass().equals(MicrometerExchangeEventNotifier.class))
.findFirst();
assertTrue(optionalExchangeEventNotifier.isPresent());

MicrometerExchangeEventNotifier eventNotifier = (MicrometerExchangeEventNotifier) optionalExchangeEventNotifier.get();
assertFalse(eventNotifier.isBaseEndpointURI());
}

public static Asset applicationProperties() {
Writer writer = new StringWriter();

Properties props = new Properties();
props.setProperty("quarkus.camel.metrics.base-endpoint-uri-exchange-event-notifier", "false");

try {
props.store(writer, "");
} catch (IOException e) {
throw new RuntimeException(e);
}

return new StringAsset(writer.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import jakarta.inject.Inject;
import org.apache.camel.CamelContext;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategy;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifier;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifierNamingStrategy;
import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyConfiguration;
Expand Down Expand Up @@ -90,8 +89,7 @@ public void testMicrometerMetricsConfiguration() {

MicrometerExchangeEventNotifier micrometerExchangeEventNotifier = (MicrometerExchangeEventNotifier) optionalExchangeEventNotifier
.get();
assertEquals(MicrometerExchangeEventNotifierNamingStrategy.DEFAULT,
micrometerExchangeEventNotifier.getNamingStrategy());
assertTrue(micrometerExchangeEventNotifier.getNamingStrategy().isBaseEndpointURI());

Optional<EventNotifier> optionalRouteEventNotifier = context.getManagementStrategy()
.getEventNotifiers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import jakarta.inject.Inject;
import org.apache.camel.CamelContext;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategy;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategyLegacy;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifier;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifierNamingStrategy;
import org.apache.camel.component.micrometer.messagehistory.MicrometerMessageHistoryFactory;
Expand Down Expand Up @@ -93,7 +93,7 @@ void legacyNamingPolicy() {

MicrometerExchangeEventNotifier micrometerExchangeEventNotifier = (MicrometerExchangeEventNotifier) optionalExchangeEventNotifier
.get();
assertEquals(MicrometerExchangeEventNotifierNamingStrategy.LEGACY,
assertInstanceOf(MicrometerExchangeEventNotifierNamingStrategyLegacy.class,
micrometerExchangeEventNotifier.getNamingStrategy());

Optional<EventNotifier> optionalRouteEventNotifier = context.getManagementStrategy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ public interface CamelMicrometerConfig {
@WithDefault("true")
boolean enableExchangeEventNotifier();

/**
* Whether to use static or dynamic values for Endpoint Name tags in captured metrics. By default, static values are
* used. When using dynamic tags, then a dynamic to (toD) can compute many different endpoint URIs that,
* can lead to many tags as the URI is dynamic, so use this with care if setting this option to false.
*
* @asciidoclet
*/
@WithDefault("true")
public boolean baseEndpointURIExchangeEventNotifier();

/**
* Set whether to enable the MicrometerRouteEventNotifier for capturing metrics on the total number of routes and total
* number of routes running.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import org.apache.camel.CamelContext;
import org.apache.camel.component.micrometer.MicrometerUtils;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategy;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategyDefault;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategyLegacy;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifier;
import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifierNamingStrategy;
import org.apache.camel.component.micrometer.messagehistory.MicrometerMessageHistoryFactory;
Expand Down Expand Up @@ -92,8 +93,16 @@ public void configure(CamelContext camelContext) {
ManagementStrategy managementStrategy = camelContext.getManagementStrategy();
if (config.enableExchangeEventNotifier()) {
MicrometerExchangeEventNotifier eventNotifier = new MicrometerExchangeEventNotifier();
eventNotifier.setBaseEndpointURI(config.baseEndpointURIExchangeEventNotifier());

if (config.namingStrategy().equals(MetricsNamingStrategy.LEGACY)) {
eventNotifier.setNamingStrategy(MicrometerExchangeEventNotifierNamingStrategy.LEGACY);
eventNotifier.setNamingStrategy(
new MicrometerExchangeEventNotifierNamingStrategyLegacy(
config.baseEndpointURIExchangeEventNotifier()));
} else {
eventNotifier.setNamingStrategy(
new MicrometerExchangeEventNotifierNamingStrategyDefault(
config.baseEndpointURIExchangeEventNotifier()));
}
managementStrategy.addEventNotifier(eventNotifier);
}
Expand Down
Loading