This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new e9c121a848d5 CAMEL-27138: camel-alibaba-sls - rename the header of
listLogStores to CamelAlibabaSlsListLogStoreName (#30344)
e9c121a848d5 is described below
commit e9c121a848d56d48c188cdacbeb40c5192ef3b96
Author: Saravanakumar Selvaraj <[email protected]>
AuthorDate: Thu Nov 19 19:12:23 2026 +1100
CAMEL-27138: camel-alibaba-sls - rename the header of listLogStores to
CamelAlibabaSlsListLogStoreName (#30344)
The Logstore name header of listLogStores, CamelAlibabaSlsLogstoreName,
differed from CamelAlibabaSlsLogStoreName only
in the case of one letter. Camel header names are case-insensitive by
default, so the two names were one header. A
header set for putLogs or getLogs also filtered a later listLogStores. A
header set for listLogStores also replaced the
logStoreName option of a later putLogs or getLogs.
The Logstore name header of listLogStores is now
CamelAlibabaSlsListLogStoreName, like CamelAlibabaSlsListOffset beside
CamelAlibabaSlsOffset; the capital S matches the logStoreName option and
the listLogStores operation. The constants keep
their names, so routes that use them need no change. The component JSON,
its catalog copy and the Endpoint DSL are
regenerated, where alibabaSlsLogstoreName() is now
alibabaSlsListLogStoreName(). The upgrade guide of 4.24 has a section
on the rename. LogstoreHeaderNamesTest covers both directions with the
constants.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../camel/catalog/components/alibaba-sls.json | 2 +-
.../camel/component/alibaba/sls/alibaba-sls.json | 2 +-
.../sls/constants/AlibabaSlsProperties.java | 2 +-
.../alibaba/sls/LogstoreHeaderNamesTest.java | 121 +++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 15 +++
.../dsl/AlibabaSlsEndpointBuilderFactory.java | 6 +-
6 files changed, 142 insertions(+), 6 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json
index e2121d137229..df4224160efd 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json
@@ -40,7 +40,7 @@
"CamelAlibabaSlsOffset": { "index": 7, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"Long", "deprecated": false, "autowired": false, "secret": false,
"description": "The offset of the first log to return for getLogs. Simple Log
Service does not use it when query contains an analytic statement. This header
replaces the offset option. If this header is not set, an exchange property of
the same name replaces the offset opt [...]
"CamelAlibabaSlsTopic": { "index": 8, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"String", "deprecated": false, "autowired": false, "secret": false,
"description": "The log topic for getLogs. This header replaces the topic
option. If this header is not set, an exchange property of the same name
replaces the topic option.", "constantName":
"org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders#TOPIC" },
"CamelAlibabaSlsReverse": { "index": 9, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"Boolean", "deprecated": false, "autowired": false, "secret": false,
"description": "Whether to return logs in descending order of log timestamps
for getLogs. Simple Log Service does not use it when query contains an analytic
statement. This header replaces the reverse option. If this header is not set,
an exchange property of the same [...]
- "CamelAlibabaSlsLogstoreName": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the Logstore for listLogStores. Simple Log Service
returns the Logstores whose name contains the value. If this header is not set,
the producer uses an exchange property of the same name. If neither of the two
is set, the producer adds [...]
+ "CamelAlibabaSlsListLogStoreName": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the Logstore for listLogStores. Simple Log Service
returns the Logstores whose name contains the value. If this header is not set,
the producer uses an exchange property of the same name. If neither of the two
is set, the producer a [...]
"CamelAlibabaSlsMode": { "index": 11, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"String", "deprecated": false, "autowired": false, "secret": false,
"description": "The type of the Logstore for listLogStores. The value must be
standard or query. If this header is not set, the producer uses an exchange
property of the same name. If neither of the two is set, the producer adds no
Logstore type to the request.", "constan [...]
"CamelAlibabaSlsSize": { "index": 12, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"Integer", "deprecated": false, "autowired": false, "secret": false,
"description": "The number of entries per page for listLogStores. Simple Log
Service accepts a value of at most 500. If this header is not set, the producer
uses an exchange property of the same name. If neither of the two is set, the
producer adds no number of entries p [...]
"CamelAlibabaSlsListOffset": { "index": 13, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "Integer", "deprecated": false, "autowired": false, "secret":
false, "description": "The offset of the first Logstore to return for
listLogStores. If this header is not set, the producer uses an exchange
property of the same name. If neither of the two is set, the producer adds no
offset to the request.", "constantName": "org.apache [...]
diff --git
a/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json
b/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json
index e2121d137229..df4224160efd 100644
---
a/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json
+++
b/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json
@@ -40,7 +40,7 @@
"CamelAlibabaSlsOffset": { "index": 7, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"Long", "deprecated": false, "autowired": false, "secret": false,
"description": "The offset of the first log to return for getLogs. Simple Log
Service does not use it when query contains an analytic statement. This header
replaces the offset option. If this header is not set, an exchange property of
the same name replaces the offset opt [...]
"CamelAlibabaSlsTopic": { "index": 8, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"String", "deprecated": false, "autowired": false, "secret": false,
"description": "The log topic for getLogs. This header replaces the topic
option. If this header is not set, an exchange property of the same name
replaces the topic option.", "constantName":
"org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders#TOPIC" },
"CamelAlibabaSlsReverse": { "index": 9, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"Boolean", "deprecated": false, "autowired": false, "secret": false,
"description": "Whether to return logs in descending order of log timestamps
for getLogs. Simple Log Service does not use it when query contains an analytic
statement. This header replaces the reverse option. If this header is not set,
an exchange property of the same [...]
- "CamelAlibabaSlsLogstoreName": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the Logstore for listLogStores. Simple Log Service
returns the Logstores whose name contains the value. If this header is not set,
the producer uses an exchange property of the same name. If neither of the two
is set, the producer adds [...]
+ "CamelAlibabaSlsListLogStoreName": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the Logstore for listLogStores. Simple Log Service
returns the Logstores whose name contains the value. If this header is not set,
the producer uses an exchange property of the same name. If neither of the two
is set, the producer a [...]
"CamelAlibabaSlsMode": { "index": 11, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"String", "deprecated": false, "autowired": false, "secret": false,
"description": "The type of the Logstore for listLogStores. The value must be
standard or query. If this header is not set, the producer uses an exchange
property of the same name. If neither of the two is set, the producer adds no
Logstore type to the request.", "constan [...]
"CamelAlibabaSlsSize": { "index": 12, "kind": "header", "displayName": "",
"group": "producer", "label": "producer", "required": false, "javaType":
"Integer", "deprecated": false, "autowired": false, "secret": false,
"description": "The number of entries per page for listLogStores. Simple Log
Service accepts a value of at most 500. If this header is not set, the producer
uses an exchange property of the same name. If neither of the two is set, the
producer adds no number of entries p [...]
"CamelAlibabaSlsListOffset": { "index": 13, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "Integer", "deprecated": false, "autowired": false, "secret":
false, "description": "The offset of the first Logstore to return for
listLogStores. If this header is not set, the producer uses an exchange
property of the same name. If neither of the two is set, the producer adds no
offset to the request.", "constantName": "org.apache [...]
diff --git
a/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/constants/AlibabaSlsProperties.java
b/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/constants/AlibabaSlsProperties.java
index cbcce18537dc..26b28a0511e3 100644
---
a/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/constants/AlibabaSlsProperties.java
+++
b/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/constants/AlibabaSlsProperties.java
@@ -51,7 +51,7 @@ public final class AlibabaSlsProperties {
public static final String REVERSE = "CamelAlibabaSlsReverse";
@Metadata(label = "producer", description = "Log store name prefix filter
for listLogStores", javaType = "String")
- public static final String LOGSTORE_NAME = "CamelAlibabaSlsLogstoreName";
+ public static final String LOGSTORE_NAME =
"CamelAlibabaSlsListLogStoreName";
@Metadata(label = "producer", description = "List mode for listLogStores",
javaType = "String")
public static final String MODE = "CamelAlibabaSlsMode";
diff --git
a/components/camel-alibaba/camel-alibaba-sls/src/test/java/org/apache/camel/component/alibaba/sls/LogstoreHeaderNamesTest.java
b/components/camel-alibaba/camel-alibaba-sls/src/test/java/org/apache/camel/component/alibaba/sls/LogstoreHeaderNamesTest.java
new file mode 100644
index 000000000000..d766886520b9
--- /dev/null
+++
b/components/camel-alibaba/camel-alibaba-sls/src/test/java/org/apache/camel/component/alibaba/sls/LogstoreHeaderNamesTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.component.alibaba.sls;
+
+import com.aliyun.sls20201230.Client;
+import com.aliyun.sls20201230.models.GetLogsRequest;
+import com.aliyun.sls20201230.models.GetLogsResponse;
+import com.aliyun.sls20201230.models.GetLogsResponseBody;
+import com.aliyun.sls20201230.models.ListLogStoresRequest;
+import com.aliyun.sls20201230.models.ListLogStoresResponse;
+import com.aliyun.sls20201230.models.ListLogStoresResponseBody;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * The header of listLogStores must not share its name with the header of the
Logstore of putLogs and getLogs, as Camel
+ * header names are case-insensitive by default (CAMEL-27138).
+ */
+class LogstoreHeaderNamesTest extends CamelTestSupport {
+
+ private final TestConfiguration testConfiguration = new
TestConfiguration();
+
+ @BindToRegistry("slsClient")
+ Client slsClient = mock(Client.class);
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:listLogStores")
+ .to("alibaba-sls:listLogStores"
+ + "?project=" +
testConfiguration.getProperty("project")
+ + "®ion=" +
testConfiguration.getProperty("region")
+ + "&endpoint=" +
testConfiguration.getProperty("endpoint")
+ + "&accessKey=" +
testConfiguration.getProperty("accessKey")
+ + "&secretKey=" +
testConfiguration.getProperty("secretKey")
+ + "&slsClient=#slsClient");
+ from("direct:getLogs")
+ .to("alibaba-sls:getLogs"
+ + "?project=" +
testConfiguration.getProperty("project")
+ + "&logStoreName=" +
testConfiguration.getProperty("logStoreName")
+ + "®ion=" +
testConfiguration.getProperty("region")
+ + "&endpoint=" +
testConfiguration.getProperty("endpoint")
+ + "&accessKey=" +
testConfiguration.getProperty("accessKey")
+ + "&secretKey=" +
testConfiguration.getProperty("secretKey")
+ + "&slsClient=#slsClient");
+ }
+ };
+ }
+
+ @Test
+ void testListLogStoresDoesNotReadTheLogStoreOfPutLogsAndGetLogs() throws
Exception {
+ when(slsClient.listLogStores(anyString(),
any(ListLogStoresRequest.class)))
+ .thenReturn(new
ListLogStoresResponse().setStatusCode(200).setBody(new
ListLogStoresResponseBody()));
+
+ Exchange result = template.send("direct:listLogStores",
+ exchange ->
exchange.getIn().setHeader(AlibabaSlsHeaders.LOG_STORE_NAME, "app-logstore"));
+
+ assertThat(result.getException()).isNull();
+ ArgumentCaptor<ListLogStoresRequest> request =
ArgumentCaptor.forClass(ListLogStoresRequest.class);
+
verify(slsClient).listLogStores(eq(testConfiguration.getProperty("project")),
request.capture());
+ assertThat(request.getValue().getLogstoreName()).isNull();
+ }
+
+ @Test
+ void testGetLogsDoesNotReadTheLogstoreNameOfListLogStores() throws
Exception {
+ when(slsClient.getLogs(anyString(), anyString(),
any(GetLogsRequest.class)))
+ .thenReturn(new
GetLogsResponse().setStatusCode(200).setBody(new GetLogsResponseBody()));
+
+ Exchange result = template.send("direct:getLogs",
+ exchange ->
exchange.getIn().setHeader(AlibabaSlsHeaders.LOGSTORE_NAME, "other-logstore"));
+
+ assertThat(result.getException()).isNull();
+ verify(slsClient).getLogs(
+ eq(testConfiguration.getProperty("project")),
+ eq(testConfiguration.getProperty("logStoreName")),
+ any(GetLogsRequest.class));
+ }
+
+ @Test
+ void testListLogStoresReadsItsLogstoreNameHeader() throws Exception {
+ when(slsClient.listLogStores(anyString(),
any(ListLogStoresRequest.class)))
+ .thenReturn(new
ListLogStoresResponse().setStatusCode(200).setBody(new
ListLogStoresResponseBody()));
+
+ Exchange result = template.send("direct:listLogStores",
+ exchange ->
exchange.getIn().setHeader(AlibabaSlsHeaders.LOGSTORE_NAME, "app"));
+
+ assertThat(result.getException()).isNull();
+ ArgumentCaptor<ListLogStoresRequest> request =
ArgumentCaptor.forClass(ListLogStoresRequest.class);
+
verify(slsClient).listLogStores(eq(testConfiguration.getProperty("project")),
request.capture());
+ assertThat(request.getValue().getLogstoreName()).isEqualTo("app");
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 289639742bc3..f438d3c439c0 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -6448,6 +6448,21 @@ the `region` or the `endpoint` option. It needs neither
when the `smsClient` opt
endpoint validation of the catalog no longer reports a URI without `region` as
missing a required option. The behavior
of the component at runtime does not change.
+=== camel-alibaba-sls - the header of listLogStores is named
CamelAlibabaSlsListLogStoreName
+
+The header with the name of the Logstore for `listLogStores` is now
`CamelAlibabaSlsListLogStoreName`. Before, it was
+`CamelAlibabaSlsLogstoreName`. That name differs from
`CamelAlibabaSlsLogStoreName`, the Logstore of `putLogs` and
+`getLogs`, only in the case of one letter. Camel header names are
case-insensitive by default, so the two names were one
+header. A header set for `putLogs` or `getLogs` also limited a later
`listLogStores` to the Logstores whose name
+contains the value. A header set for `listLogStores` also replaced the
`logStoreName` option of a later `putLogs` or
+`getLogs`.
+
+Routes that use the constant `AlibabaSlsHeaders.LOGSTORE_NAME` work without
changes, as only its value changed. Routes
+that use the header or the exchange property by its literal name must use the
new name. By default, the producer now
+reads a header with the previous name only as the Logstore of `putLogs` and
`getLogs`. The producer no longer reads an
+exchange property with the previous name. The Endpoint DSL method
`alibabaSlsLogstoreName()` is now
+`alibabaSlsListLogStoreName()`.
+
=== camel-pqc - a configured KeyGenerator or KeyAgreement is used by one
exchange at a time
When Camel creates the instance itself, the KEM operations of the `pqc`
component (including the hybrid KEM
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaSlsEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaSlsEndpointBuilderFactory.java
index 445740fceb3d..52e1ccb9f07a 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaSlsEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaSlsEndpointBuilderFactory.java
@@ -759,10 +759,10 @@ public interface AlibabaSlsEndpointBuilderFactory {
*
* Group: producer
*
- * @return the name of the header {@code AlibabaSlsLogstoreName}.
+ * @return the name of the header {@code AlibabaSlsListLogStoreName}.
*/
- public String alibabaSlsLogstoreName() {
- return "CamelAlibabaSlsLogstoreName";
+ public String alibabaSlsListLogStoreName() {
+ return "CamelAlibabaSlsListLogStoreName";
}
/**
* The type of the Logstore for listLogStores. The value must be