This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.14.x by this push:
     new f79cbe3f8bc3 CAMEL-23597: camel-solr - align Exchange header prefix 
constants with Camel naming convention (4.14.x backport) (#23489)
f79cbe3f8bc3 is described below

commit f79cbe3f8bc3fe1095d8492e9ef321289451d457
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon May 25 11:23:52 2026 +0200

    CAMEL-23597: camel-solr - align Exchange header prefix constants with Camel 
naming convention (4.14.x backport) (#23489)
    
    Backport of #23410 onto camel-4.14.x. Rename the two prefix constants in
    SolrConstants (camel-solr) from "SolrField." / "SolrParam." to
    "CamelSolrField." / "CamelSolrParam.", completing the CamelSolrXxx
    alignment started in CAMEL-21697. Java field names unchanged; updates
    the integration tests, inline comments, solr-component.adoc, and adds a
    4.14 upgrade-guide entry.
    
    The SolrPingAndSearchTest comment-rename hunk does not apply on this
    branch because the corresponding testQueryWithMultipleFilters test was
    added on main as part of CAMEL-22465 and is not present here.
---
 .../camel-solr/src/main/docs/solr-component.adoc   |  8 ++---
 .../apache/camel/component/solr/SolrConstants.java |  4 +--
 .../apache/camel/component/solr/SolrProducer.java  |  4 +--
 .../solr/converter/SolrRequestConverter.java       |  4 +--
 .../solr/integration/SolrInsertAndDeleteTest.java  | 38 +++++++++++-----------
 .../solr/integration/SolrTestSupport.java          |  2 +-
 .../ROOT/pages/camel-4x-upgrade-guide-4_14.adoc    | 31 ++++++++++++++++++
 7 files changed, 61 insertions(+), 30 deletions(-)

diff --git a/components/camel-solr/src/main/docs/solr-component.adoc 
b/components/camel-solr/src/main/docs/solr-component.adoc
index dbf71009b8da..83b82a06ea5c 100644
--- a/components/camel-solr/src/main/docs/solr-component.adoc
+++ b/components/camel-solr/src/main/docs/solr-component.adoc
@@ -69,7 +69,7 @@ the following. Some operations also require the message body 
to be set.
 |=======================================================================
 |Operation |Message body |Description
 
-|`INSERT` | n/a |inserts/updates a document using message headers (solr fields 
must be prefixed with "SolrField.")
+|`INSERT` | n/a |inserts/updates a document using message headers (solr fields 
must be prefixed with "CamelSolrField.")
 |`INSERT` | File |inserts/updates a document or documents using the given File 
(using ContentStreamUpdateRequest)
 |`INSERT` | SolrInputDocument or Collection<SolrInputDocument>|inserts/updates 
a document or documents based on the given (collection of) SolrInputDocument
 |`INSERT` | bean or Collection<bean> |inserts/updates a document or documents 
based on values in an 
http://wiki.apache.org/solr/Solrj#Directly_adding_POJOs_to_Solr[annotated bean]
@@ -110,7 +110,7 @@ from("direct:search")
     <setHeader name="CamelSolrOperation">
         <constant>INSERT</constant>
     </setHeader>
-    <setHeader name="SolrField.id">
+    <setHeader name="CamelSolrField.id">
         <simple>${body}</simple>
     </setHeader>
     <to uri="solr://localhost:8983/solr"/>
@@ -136,8 +136,8 @@ delete routes and then call the commit route.
 
 [source,java]
 -----------------------------------------------
-template.sendBodyAndHeader("direct:insert", "1234", "SolrParam.commit", true);
-template.sendBodyAndHeader("direct:delete", "1234", "SolrParam.commit", true);
+template.sendBodyAndHeader("direct:insert", "1234", "CamelSolrParam.commit", 
true);
+template.sendBodyAndHeader("direct:delete", "1234", "CamelSolrParam.commit", 
true);
 template.sendBody("direct:search", "id:1234");
 -----------------------------------------------
 
diff --git 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java
 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java
index 46e45631e989..d5bfc3073005 100644
--- 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java
+++ 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java
@@ -42,8 +42,8 @@ public interface SolrConstants {
     @Metadata(description = "The content type is used to identify the type 
when inserting files.", javaType = "String")
     String PARAM_CONTENT_TYPE = Exchange.CONTENT_TYPE;
 
-    String HEADER_FIELD_PREFIX = "SolrField.";
-    String HEADER_PARAM_PREFIX = "SolrParam.";
+    String HEADER_FIELD_PREFIX = "CamelSolrField.";
+    String HEADER_PARAM_PREFIX = "CamelSolrParam.";
 
     String PROPERTY_ACTION_CONTEXT = "SolrActionContext";
 
diff --git 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
index ee3b5bbb0673..b53cdca6037f 100644
--- 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
+++ 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
@@ -69,7 +69,7 @@ public class SolrProducer extends DefaultAsyncProducer {
                 ? message.getHeader(SolrConstants.PARAM_REQUEST_HANDLER, 
String.class)
                 : configuration.getRequestHandler();
 
-        // Retrieve all SolrParams: SolrParams header and SolrParam.xxx headers
+        // Retrieve all SolrParams: SolrParams header and CamelSolrParam.xxx 
headers
         ModifiableSolrParams modifiableSolrParams = 
getAndGroupedSolrParams(message);
         boolean hasSolrParams = modifiableSolrParams.size() > 0;
 
@@ -130,7 +130,7 @@ public class SolrProducer extends DefaultAsyncProducer {
         ModifiableSolrParams modifiableSolrParams = solrParams instanceof 
ModifiableSolrParams
                 ? (ModifiableSolrParams) solrParams
                 : new ModifiableSolrParams(solrParams);
-        // add possible headers that start with "SolrParam." prefix
+        // add possible headers that start with "CamelSolrParam." prefix
         message.getHeaders().entrySet().stream()
                 .filter(entry -> 
entry.getKey().startsWith(SolrConstants.HEADER_PARAM_PREFIX))
                 .forEach(entry -> {
diff --git 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/converter/SolrRequestConverter.java
 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/converter/SolrRequestConverter.java
index 46f3bdc914f2..4a1faa82cc14 100644
--- 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/converter/SolrRequestConverter.java
+++ 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/converter/SolrRequestConverter.java
@@ -226,14 +226,14 @@ public final class SolrRequestConverter {
             docs.ifPresent(updateRequest::add);
             return updateRequest;
         }
-        // Map: gather solr fields from body and merge with solr fields from 
headers (gathered from SolrField.xxx headers)
+        // Map: gather solr fields from body and merge with solr fields from 
headers (gathered from CamelSolrField.xxx headers)
         //      The header solr fields have priority
         Map<String, Object> map = new LinkedHashMap<>(getMapFromBody(body));
         map.putAll(getMapFromHeaderSolrFields(exchange));
         if (!map.isEmpty()) {
             body = map;
         }
-        // Map: translate to SolrInputDocument (possibly gathered from 
SolrField.xxx headers
+        // Map: translate to SolrInputDocument (possibly gathered from 
CamelSolrField.xxx headers
         Optional<SolrInputDocument> doc = 
getOptionalSolrInputDocumentFromMap(body, exchange);
         if (doc.isPresent()) {
             updateRequest.add(doc.get());
diff --git 
a/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrInsertAndDeleteTest.java
 
b/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrInsertAndDeleteTest.java
index 47903af844e6..1a17397683d8 100644
--- 
a/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrInsertAndDeleteTest.java
+++ 
b/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrInsertAndDeleteTest.java
@@ -191,7 +191,7 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
     public void testInsertStreaming() {
         // TODO rename method
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
-                .withHeader("SolrField.id", "MA147LL/A");
+                .withHeader("CamelSolrField.id", "MA147LL/A");
         executeInsert(builder.build());
 
         QueryResponse response = executeSolrQuery("id:MA147LL/A");
@@ -202,7 +202,7 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
     @Test
     public void indexSingleDocumentOnlyWithId() {
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
-                .withHeader("SolrField.id", "MA147LL/A");
+                .withHeader("CamelSolrField.id", "MA147LL/A");
         executeInsert(builder.build());
 
         // Check things were indexed.
@@ -223,9 +223,9 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
     public void setHeadersAsSolrFields() {
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
                 .withBody("Body is ignored")
-                .withHeader("SolrField.id", "MA147LL/A")
-                .withHeader("SolrField.name_s", "Apple 60 GB iPod with Video 
Playback Black")
-                .withHeader("SolrField.manu_s", "Apple Computer Inc.");
+                .withHeader("CamelSolrField.id", "MA147LL/A")
+                .withHeader("CamelSolrField.name_s", "Apple 60 GB iPod with 
Video Playback Black")
+                .withHeader("CamelSolrField.manu_s", "Apple Computer Inc.");
         executeInsert(builder.build());
 
         QueryResponse response = executeSolrQuery("id:MA147LL/A");
@@ -242,8 +242,8 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
         String[] categories = { "electronics", "apple" };
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
                 .withBody("Test body for iPod.")
-                .withHeader("SolrField.id", "MA147LL/A")
-                .withHeader("SolrField.cat", categories);
+                .withHeader("CamelSolrField.id", "MA147LL/A")
+                .withHeader("CamelSolrField.cat", categories);
         executeInsert(builder.build());
 
         // Check things were indexed.
@@ -259,9 +259,9 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
     @Test
     public void indexDocumentsAndThenCommit() {
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
-                .withHeader("SolrField.id", "MA147LL/A")
-                .withHeader("SolrField.name", "Apple 60 GB iPod with Video 
Playback Black")
-                .withHeader("SolrField.manu", "Apple Computer Inc.");
+                .withHeader("CamelSolrField.id", "MA147LL/A")
+                .withHeader("CamelSolrField.name", "Apple 60 GB iPod with 
Video Playback Black")
+                .withHeader("CamelSolrField.manu", "Apple Computer Inc.");
         executeInsert(builder.build(), false);
 
         QueryResponse response = executeSolrQuery("*:*");
@@ -279,7 +279,7 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
     public void indexWithAutoCommit() {
         // new exchange - not autocommit route
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
-                .withHeader("SolrField.content", "NO_AUTO_COMMIT");
+                .withHeader("CamelSolrField.content", "NO_AUTO_COMMIT");
         executeInsert(DEFAULT_START_ENDPOINT, builder.build(), false);
         // not committed
         QueryResponse response = executeSolrQuery("*:*");
@@ -292,7 +292,7 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
 
         // new exchange - autocommit route
         builder = ExchangeBuilder.anExchange(camelContext())
-                .withHeader("SolrField.content", "AUTO_COMMIT");
+                .withHeader("CamelSolrField.content", "AUTO_COMMIT");
         executeInsert(DEFAULT_START_ENDPOINT_AUTO_COMMIT, builder.build(), 
false);
         // should be committed
         response = executeSolrQuery("*:*");
@@ -303,9 +303,9 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
     @Test
     public void invalidSolrParametersAreIgnored() {
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
-                .withHeader("SolrField.id", "MA147LL/A")
-                .withHeader("SolrField.name", "Apple 60 GB iPod with Video 
Playback Black")
-                .withHeader("SolrParam.invalid-param", "this is ignored");
+                .withHeader("CamelSolrField.id", "MA147LL/A")
+                .withHeader("CamelSolrField.name", "Apple 60 GB iPod with 
Video Playback Black")
+                .withHeader("CamelSolrParam.invalid-param", "this is ignored");
         executeInsert(builder.build());
 
         QueryResponse response = executeSolrQuery("*:*");
@@ -374,9 +374,9 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
                 .withBody(new File("src/test/resources/data/books.csv"))
                 .withHeader(SolrConstants.PARAM_CONTENT_TYPE, "text/csv")
-                .withHeader("SolrParam.fieldnames", 
"id,cat,name,price,inStock,author_t,series_t,sequence_i,genre_s")
-                .withHeader("SolrParam.skip", "cat,sequence_i,genre_s")
-                .withHeader("SolrParam.skipLines", 1);
+                .withHeader("CamelSolrParam.fieldnames", 
"id,cat,name,price,inStock,author_t,series_t,sequence_i,genre_s")
+                .withHeader("CamelSolrParam.skip", "cat,sequence_i,genre_s")
+                .withHeader("CamelSolrParam.skipLines", 1);
         executeInsert(builder.build());
         QueryResponse response = executeSolrQuery("*:*");
         assertEquals(0, response.getStatus());
@@ -392,7 +392,7 @@ public class SolrInsertAndDeleteTest extends 
SolrTestSupport {
 
         ExchangeBuilder builder = ExchangeBuilder.anExchange(camelContext())
                 .withBody(new File("src/test/resources/data/tutorial.pdf"))
-                .withHeader("SolrParam.literal.id", "tutorial.pdf");
+                .withHeader("CamelSolrParam.literal.id", "tutorial.pdf");
         executeInsert(builder.build());
 
         QueryResponse response = executeSolrQuery("*:*");
diff --git 
a/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java
 
b/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java
index e25a83aa0cae..0e8cc8c25717 100644
--- 
a/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java
+++ 
b/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java
@@ -147,7 +147,7 @@ public abstract class SolrTestSupport implements 
CamelTestSupportHelper, Configu
     protected void solrInsertTestEntry(String id) {
         Map<String, Object> headers = new HashMap<>();
         headers.put(SolrConstants.PARAM_OPERATION, 
SolrConstants.OPERATION_INSERT);
-        headers.put("SolrField.id", id);
+        headers.put("CamelSolrField.id", id);
         template.sendBodyAndHeaders(DEFAULT_START_ENDPOINT, "", headers);
     }
 
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc
index 22c067367ae0..414a8eb0ab01 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_14.adoc
@@ -181,6 +181,37 @@ As a consequence, the generated Endpoint DSL header 
accessors on
 * `linkType()` -> `jiraLinkType()`
 * `minutesSpent()` -> `jiraMinutesSpent()`
 
+=== camel-solr
+
+The two Exchange header prefix constants in `SolrConstants` have been renamed 
to
+follow the Camel naming convention already used by the other constants in the
+same file (which were renamed in 4.10 under CAMEL-21697). The Java field names
+are unchanged; only the prefix string values have changed:
+
+[options="header"]
+|===
+| Constant | Previous value | New value
+| `SolrConstants.HEADER_FIELD_PREFIX` | `SolrField.` | `CamelSolrField.`
+| `SolrConstants.HEADER_PARAM_PREFIX` | `SolrParam.` | `CamelSolrParam.`
+|===
+
+Routes that reference the constants symbolically (for example
+`setHeader(SolrConstants.HEADER_FIELD_PREFIX + "id", ...)`) continue to work
+without changes. Routes that set the headers by their literal string value
+(for example `setHeader("SolrField.id", ...)` or
+`setHeader("SolrParam.commit", ...)`) must be updated to use the new prefix
+(`CamelSolrField.id`, `CamelSolrParam.commit`).
+
+Because the renamed prefixes now begin with `Camel`, they are stripped by the
+standard transport `HeaderFilterStrategy` (`HttpHeaderFilterStrategy`, etc.)
+when crossing a transport boundary, by design — `Camel*` headers are
+framework-internal and are not propagated over the wire. Routes that bridge an
+external transport (HTTP, JMS, ...) into a `solr:` producer and want to drive
+Solr document fields or query parameters from a header supplied by the sender
+must therefore carry the value in a non-`Camel`-prefixed application header and
+map it to the appropriate `CamelSolrField.*` / `CamelSolrParam.*` header in the
+route between the transport `from` and the `solr:` `to`.
+
 == Upgrading from 4.14.5 to 4.14.6
 
 === camel-platform-http-main

Reply via email to