This is an automated email from the ASF dual-hosted git repository.
oscerd 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 bdd40cf23f2b CAMEL-23574: camel-dns - align Exchange header constant
names with Camel naming convention (#23411)
bdd40cf23f2b is described below
commit bdd40cf23f2b22cd293ddad319069a7b3b3c6c70
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu May 21 14:03:18 2026 +0200
CAMEL-23574: camel-dns - align Exchange header constant names with Camel
naming convention (#23411)
Rename the Exchange header string values in DnsConstants from dotted
lowercase
(dns.class / dns.name / dns.domain / dns.server / dns.type / term) to the
project-wide Camel<Component><Field> convention used across the rest of the
component catalog:
DNS_CLASS -> CamelDnsClass
DNS_NAME -> CamelDnsName
DNS_DOMAIN -> CamelDnsDomain
DNS_SERVER -> CamelDnsServer
DNS_TYPE -> CamelDnsType
TERM -> CamelDnsTerm
The Java field names (DNS_CLASS, DNS_NAME, DNS_DOMAIN, DNS_SERVER, DNS_TYPE,
TERM) are unchanged so routes and code that reference the constants
symbolically
continue to work without changes. Routes that set the headers by their
literal
string value must be updated.
Updates the in-module tests that previously set the headers by literal
value to
go through DnsConstants instead, refreshes the DnsComponent /
DnsWikipediaProducer
Javadoc and the component documentation references, adds a 4.21
upgrade-guide
entry mirroring CAMEL-23526 / CAMEL-23532, and regenerates the component
metadata, catalog, and endpoint DSL factory.
The stale dns:///dig "dns.query" documentation reference (which never
matched
any real header read by DnsDigProducer) is updated to CamelDnsName, the
actual
header consumed by the dig producer.
Consistent with the same alignment applied in CAMEL-23506, CAMEL-23515,
CAMEL-23516, CAMEL-23522, CAMEL-23526 and CAMEL-23532.
Reported by Claude Code on behalf of Andrea Cosentino
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../org/apache/camel/catalog/components/dns.json | 12 ++---
.../org/apache/camel/component/dns/dns.json | 12 ++---
.../camel-dns/src/main/docs/dns-component.adoc | 6 +--
.../apache/camel/component/dns/DnsComponent.java | 22 +++++----
.../apache/camel/component/dns/DnsConstants.java | 12 ++---
.../camel/component/dns/DnsWikipediaProducer.java | 2 +-
.../component/dns/DnsDigEndpointSpringTest.java | 4 +-
.../camel/component/dns/DnsDigEndpointTest.java | 4 +-
.../component/dns/DnsIpEndpointSpringTest.java | 6 +--
.../camel/component/dns/DnsIpEndpointTest.java | 6 +--
.../component/dns/DnsIpHeaderTransferTest.java | 6 +--
.../component/dns/DnsLookupEndpointSpringTest.java | 8 ++--
.../camel/component/dns/DnsLookupEndpointTest.java | 8 ++--
.../component/dns/WikipediaEndpointSpringTest.java | 2 +-
.../camel/component/dns/WikipediaEndpointTest.java | 2 +-
.../ROOT/pages/camel-4x-upgrade-guide-4_21.adoc | 54 ++++++++++++++++++++++
.../endpoint/dsl/DnsEndpointBuilderFactory.java | 26 +++++------
17 files changed, 124 insertions(+), 68 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json
index 59571aed3b5a..24e2f951b1a1 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json
@@ -28,12 +28,12 @@
"autowiredEnabled": { "index": 1, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
},
"headers": {
- "dns.class": { "index": 0, "kind": "header", "displayName": "", "group":
"lookup dig", "label": "lookup dig", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The DNS class of the lookup. Should match the values of
org.xbill.dns.DClass. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_CLASS" },
- "dns.name": { "index": 1, "kind": "header", "displayName": "", "group":
"lookup", "label": "lookup", "required": true, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The name to lookup", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_NAME" },
- "dns.domain": { "index": 2, "kind": "header", "displayName": "", "group":
"ip", "label": "ip", "required": true, "javaType": "String", "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": false,
"description": "The domain name.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_DOMAIN" },
- "dns.server": { "index": 3, "kind": "header", "displayName": "", "group":
"dig", "label": "dig", "required": false, "javaType": "String", "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": false,
"description": "The server in particular for the query. If none is given, the
default one specified by the OS will be used. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_SERVER" },
- "dns.type": { "index": 4, "kind": "header", "displayName": "", "group":
"lookup dig", "label": "lookup dig", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The type of the lookup. Should match the values of
org.xbill.dns.Type. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_TYPE" },
- "term": { "index": 5, "kind": "header", "displayName": "", "group":
"wikipedia", "label": "wikipedia", "required": true, "javaType": "",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The term", "constantName":
"org.apache.camel.component.dns.DnsConstants#TERM" }
+ "CamelDnsClass": { "index": 0, "kind": "header", "displayName": "",
"group": "lookup dig", "label": "lookup dig", "required": false, "javaType":
"String", "deprecated": false, "deprecationNote": "", "autowired": false,
"secret": false, "description": "The DNS class of the lookup. Should match the
values of org.xbill.dns.DClass. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_CLASS" },
+ "CamelDnsName": { "index": 1, "kind": "header", "displayName": "",
"group": "lookup", "label": "lookup", "required": true, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The name to lookup", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_NAME" },
+ "CamelDnsDomain": { "index": 2, "kind": "header", "displayName": "",
"group": "ip", "label": "ip", "required": true, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The domain name.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_DOMAIN" },
+ "CamelDnsServer": { "index": 3, "kind": "header", "displayName": "",
"group": "dig", "label": "dig", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The server in particular for the query. If none is
given, the default one specified by the OS will be used. Optional.",
"constantName": "org.apache.camel.component.dns.DnsConstants#DNS_SERVER" },
+ "CamelDnsType": { "index": 4, "kind": "header", "displayName": "",
"group": "lookup dig", "label": "lookup dig", "required": false, "javaType":
"String", "deprecated": false, "deprecationNote": "", "autowired": false,
"secret": false, "description": "The type of the lookup. Should match the
values of org.xbill.dns.Type. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_TYPE" },
+ "CamelDnsTerm": { "index": 5, "kind": "header", "displayName": "",
"group": "wikipedia", "label": "wikipedia", "required": true, "javaType": "",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The term", "constantName":
"org.apache.camel.component.dns.DnsConstants#TERM" }
},
"properties": {
"dnsType": { "index": 0, "kind": "path", "displayName": "Dns Type",
"group": "producer", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.dns.DnsType", "enum": [ "dig", "ip", "lookup",
"wikipedia" ], "deprecated": false, "deprecationNote": "", "autowired": false,
"secret": false, "description": "The type of the lookup." },
diff --git
a/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json
b/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json
index 59571aed3b5a..24e2f951b1a1 100644
---
a/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json
+++
b/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json
@@ -28,12 +28,12 @@
"autowiredEnabled": { "index": 1, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
},
"headers": {
- "dns.class": { "index": 0, "kind": "header", "displayName": "", "group":
"lookup dig", "label": "lookup dig", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The DNS class of the lookup. Should match the values of
org.xbill.dns.DClass. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_CLASS" },
- "dns.name": { "index": 1, "kind": "header", "displayName": "", "group":
"lookup", "label": "lookup", "required": true, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The name to lookup", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_NAME" },
- "dns.domain": { "index": 2, "kind": "header", "displayName": "", "group":
"ip", "label": "ip", "required": true, "javaType": "String", "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": false,
"description": "The domain name.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_DOMAIN" },
- "dns.server": { "index": 3, "kind": "header", "displayName": "", "group":
"dig", "label": "dig", "required": false, "javaType": "String", "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": false,
"description": "The server in particular for the query. If none is given, the
default one specified by the OS will be used. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_SERVER" },
- "dns.type": { "index": 4, "kind": "header", "displayName": "", "group":
"lookup dig", "label": "lookup dig", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The type of the lookup. Should match the values of
org.xbill.dns.Type. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_TYPE" },
- "term": { "index": 5, "kind": "header", "displayName": "", "group":
"wikipedia", "label": "wikipedia", "required": true, "javaType": "",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The term", "constantName":
"org.apache.camel.component.dns.DnsConstants#TERM" }
+ "CamelDnsClass": { "index": 0, "kind": "header", "displayName": "",
"group": "lookup dig", "label": "lookup dig", "required": false, "javaType":
"String", "deprecated": false, "deprecationNote": "", "autowired": false,
"secret": false, "description": "The DNS class of the lookup. Should match the
values of org.xbill.dns.DClass. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_CLASS" },
+ "CamelDnsName": { "index": 1, "kind": "header", "displayName": "",
"group": "lookup", "label": "lookup", "required": true, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The name to lookup", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_NAME" },
+ "CamelDnsDomain": { "index": 2, "kind": "header", "displayName": "",
"group": "ip", "label": "ip", "required": true, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The domain name.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_DOMAIN" },
+ "CamelDnsServer": { "index": 3, "kind": "header", "displayName": "",
"group": "dig", "label": "dig", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The server in particular for the query. If none is
given, the default one specified by the OS will be used. Optional.",
"constantName": "org.apache.camel.component.dns.DnsConstants#DNS_SERVER" },
+ "CamelDnsType": { "index": 4, "kind": "header", "displayName": "",
"group": "lookup dig", "label": "lookup dig", "required": false, "javaType":
"String", "deprecated": false, "deprecationNote": "", "autowired": false,
"secret": false, "description": "The type of the lookup. Should match the
values of org.xbill.dns.Type. Optional.", "constantName":
"org.apache.camel.component.dns.DnsConstants#DNS_TYPE" },
+ "CamelDnsTerm": { "index": 5, "kind": "header", "displayName": "",
"group": "wikipedia", "label": "wikipedia", "required": true, "javaType": "",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The term", "constantName":
"org.apache.camel.component.dns.DnsConstants#TERM" }
},
"properties": {
"dnsType": { "index": 0, "kind": "path", "displayName": "Dns Type",
"group": "producer", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.dns.DnsType", "enum": [ "dig", "ip", "lookup",
"wikipedia" ], "deprecated": false, "deprecationNote": "", "autowired": false,
"secret": false, "description": "The type of the lookup." },
diff --git a/components/camel-dns/src/main/docs/dns-component.adoc
b/components/camel-dns/src/main/docs/dns-component.adoc
index c8d70d63bf4d..69aee0545583 100644
--- a/components/camel-dns/src/main/docs/dns-component.adoc
+++ b/components/camel-dns/src/main/docs/dns-component.adoc
@@ -73,7 +73,7 @@ include::partial$component-endpoint-headers.adoc[]
This looks up a domain's IP. For example, _www.example.com_ resolves to
192.0.32.10.
-The IP address to lookup must be provided in the header with key
`"dns.domain"`.
+The IP address to lookup must be provided in the header with key
`"CamelDnsDomain"`.
=== DNS lookup
@@ -87,7 +87,7 @@ The IP address to lookup must be provided in the header with
key `"dns.domain"`.
This returns a set of DNS records associated with a domain. +
The name to lookup must be provided in the header with key
-`"dns.name"`.
+`"CamelDnsName"`.
=== DNS Dig
@@ -101,7 +101,7 @@ Dig is a Unix command-line utility to run DNS queries.
</route>
----
-The query must be provided in the header with key `"dns.query"`.
+The query must be provided in the header with key `"CamelDnsName"`.
=== Dns Activation Policy
diff --git
a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsComponent.java
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsComponent.java
index 48ca3461ce52..c74542bd46f6 100644
---
a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsComponent.java
+++
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsComponent.java
@@ -31,25 +31,27 @@ import org.apache.camel.support.DefaultComponent;
* <p>
* dns:///ip <br/>
* <p/>
- * This will return the IP address associated with the domain passed in the
header dns.domain.
+ * This will return the IP address associated with the domain passed in the
header CamelDnsDomain.
* </p>
* <p>
* dns:///lookup This endpoint accepts three parameters.
* <ul>
- * <li>dns.name: the lookup name. Usually the domain. Mandatory.</li>
- * <li>dns.type: the type of the lookup. Should match the values of {@see
org.xbill.dns.Type}. Optional.</li>
- * <li>dns.class: the DNS class of the lookup. Should match the values of
{@see org.xbill.dns.DClass}. Optional.</li>
+ * <li>CamelDnsName: the lookup name. Usually the domain. Mandatory.</li>
+ * <li>CamelDnsType: the type of the lookup. Should match the values of {@see
org.xbill.dns.Type}. Optional.</li>
+ * <li>CamelDnsClass: the DNS class of the lookup. Should match the values of
{@see org.xbill.dns.DClass}.
+ * Optional.</li>
* </ul>
* </p>
* <p/>
* <p>
* dns:///dig This endpoint takes a few parameters, most of them optional :
* <ul>
- * <li>dns.server: the server in particular for the query. If none is given,
the default one specified by the OS will be
- * used.</li>
- * <li>dns.query: the query itself. Mandatory.</li>
- * <li>dns.type: the type of the lookup. Should match the values of {@see
org.xbill.dns.Type}. Optional.</li>
- * <li>dns.class: the DNS class of the lookup. Should match the values of
{@see org.xbill.dns.DClass}. Optional.</li>
+ * <li>CamelDnsServer: the server in particular for the query. If none is
given, the default one specified by the OS
+ * will be used.</li>
+ * <li>CamelDnsName: the lookup name to query. Mandatory.</li>
+ * <li>CamelDnsType: the type of the lookup. Should match the values of {@see
org.xbill.dns.Type}. Optional.</li>
+ * <li>CamelDnsClass: the DNS class of the lookup. Should match the values of
{@see org.xbill.dns.DClass}.
+ * Optional.</li>
* </ul>
* <p/>
* </p>
@@ -57,7 +59,7 @@ import org.apache.camel.support.DefaultComponent;
* <p>
* dns:///wikipedia This endpoint takes one paramter :
* <ul>
- * <li>term: the search term on wikipedia</li>
+ * <li>CamelDnsTerm: the search term on wikipedia</li>
* </ul>
* <p/>
* </p>
diff --git
a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsConstants.java
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsConstants.java
index 2c934532dff4..0c5bce4457a9 100644
---
a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsConstants.java
+++
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsConstants.java
@@ -28,21 +28,21 @@ public class DnsConstants {
@Metadata(label = "lookup dig", description = "The DNS class of the
lookup. Should match the values of\n" +
"`org.xbill.dns.DClass`.
Optional.",
javaType = "String")
- public static final String DNS_CLASS = "dns.class";
+ public static final String DNS_CLASS = "CamelDnsClass";
@Metadata(label = "lookup", description = "The name to lookup", javaType =
"String", required = true)
- public static final String DNS_NAME = "dns.name";
+ public static final String DNS_NAME = "CamelDnsName";
@Metadata(label = "ip", description = "The domain name.", javaType =
"String", required = true)
- public static final String DNS_DOMAIN = "dns.domain";
+ public static final String DNS_DOMAIN = "CamelDnsDomain";
@Metadata(label = "dig", description = "The server in particular for the
query. If none is given, the default\n" +
"one specified by the OS will be
used. Optional.",
javaType = "String")
- public static final String DNS_SERVER = "dns.server";
+ public static final String DNS_SERVER = "CamelDnsServer";
@Metadata(label = "lookup dig", description = "The type of the lookup.
Should match the values of `org.xbill.dns.Type`.\n" +
"Optional.",
javaType = "String")
- public static final String DNS_TYPE = "dns.type";
+ public static final String DNS_TYPE = "CamelDnsType";
@Metadata(label = "wikipedia", description = "The term", required = true)
- public static final String TERM = "term";
+ public static final String TERM = "CamelDnsTerm";
protected DnsConstants() {
//Utility class
diff --git
a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsWikipediaProducer.java
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsWikipediaProducer.java
index 3e9a0ce2018b..2cf0d2bacf38 100644
---
a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsWikipediaProducer.java
+++
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsWikipediaProducer.java
@@ -34,7 +34,7 @@ import org.xbill.DNS.Type;
* <p/>
* See here for a reference:
http://www.commandlinefu.com/commands/view/2829/query-wikipedia-via-console-over-dns
* <p/>
- * This endpoint accepts the following header: term: a simple term to use to
query wikipedia.
+ * This endpoint accepts the following header: CamelDnsTerm: a simple term to
use to query wikipedia.
*/
public class DnsWikipediaProducer extends DefaultProducer {
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointSpringTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointSpringTest.java
index d30cbd895f88..a761672485c8 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointSpringTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointSpringTest.java
@@ -66,8 +66,8 @@ public class DnsDigEndpointSpringTest extends
CamelSpringTestSupport {
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("dns.name", "monkey.wp.dg.cx");
- headers.put("dns.type", "TXT");
+ headers.put(DnsConstants.DNS_NAME, "monkey.wp.dg.cx");
+ headers.put(DnsConstants.DNS_TYPE, "TXT");
template.sendBodyAndHeaders(null, headers);
resultEndpoint.assertIsSatisfied();
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
index be6e1bc1f61e..73c7f0a13f40 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
@@ -71,8 +71,8 @@ public class DnsDigEndpointTest extends CamelTestSupport {
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("dns.name", "monkey.wp.dg.cx");
- headers.put("dns.type", "TXT");
+ headers.put(DnsConstants.DNS_NAME, "monkey.wp.dg.cx");
+ headers.put(DnsConstants.DNS_TYPE, "TXT");
template.sendBodyAndHeaders(null, headers);
resultEndpoint.assertIsSatisfied();
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointSpringTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointSpringTest.java
index ef0a9f7b006d..83559785449c 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointSpringTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointSpringTest.java
@@ -44,7 +44,7 @@ public class DnsIpEndpointSpringTest extends
CamelSpringTestSupport {
void testNullIPRequests() throws Exception {
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.domain", null);
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN, null);
});
assertTrue(e.getCause() instanceof IllegalArgumentException);
resultEndpoint.assertIsSatisfied();
@@ -54,7 +54,7 @@ public class DnsIpEndpointSpringTest extends
CamelSpringTestSupport {
void testEmptyIPRequests() throws Exception {
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.domain", "");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN, "");
});
assertTrue(e.getCause() instanceof IllegalArgumentException);
resultEndpoint.assertIsSatisfied();
@@ -67,7 +67,7 @@ public class DnsIpEndpointSpringTest extends
CamelSpringTestSupport {
resultEndpoint.expectedBodiesReceived("40.79.78.1");
- template.sendBodyAndHeader("hello", "dns.domain", "www.apache.org");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN,
"www.apache.org");
resultEndpoint.assertIsSatisfied();
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointTest.java
index 09c1e4bfe401..45c7b3350ee8 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpEndpointTest.java
@@ -53,7 +53,7 @@ public class DnsIpEndpointTest extends CamelTestSupport {
void testNullIPRequests() throws Exception {
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.domain", null);
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN, null);
});
assertTrue(e.getCause() instanceof IllegalArgumentException);
resultEndpoint.assertIsSatisfied();
@@ -63,7 +63,7 @@ public class DnsIpEndpointTest extends CamelTestSupport {
void testEmptyIPRequests() throws Exception {
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.domain", "");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN, "");
});
assertTrue(e.getCause() instanceof IllegalArgumentException);
resultEndpoint.assertIsSatisfied();
@@ -76,7 +76,7 @@ public class DnsIpEndpointTest extends CamelTestSupport {
resultEndpoint.expectedBodiesReceived("40.79.78.1");
- template.sendBodyAndHeader("hello", "dns.domain", "www.apache.org");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN,
"www.apache.org");
resultEndpoint.assertIsSatisfied();
}
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpHeaderTransferTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpHeaderTransferTest.java
index 833ec5eb1d26..51a9995e9e3f 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpHeaderTransferTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsIpHeaderTransferTest.java
@@ -51,7 +51,7 @@ public class DnsIpHeaderTransferTest extends CamelTestSupport
{
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.domain", null);
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN, null);
});
assertTrue(e.getCause() instanceof IllegalArgumentException);
resultEndpoint.assertIsSatisfied();
@@ -62,7 +62,7 @@ public class DnsIpHeaderTransferTest extends CamelTestSupport
{
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.domain", "");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN, "");
});
assertTrue(e.getCause() instanceof IllegalArgumentException);
resultEndpoint.assertIsSatisfied();
@@ -76,7 +76,7 @@ public class DnsIpHeaderTransferTest extends CamelTestSupport
{
resultEndpoint.expectedBodiesReceived("40.79.78.1");
resultEndpoint.expectedHeaderReceived("foo", "bar");
- template.sendBodyAndHeader("hello", "dns.domain", "www.apache.org");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_DOMAIN,
"www.apache.org");
resultEndpoint.assertIsSatisfied();
}
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java
index de583d088bf2..c7a629742f0c 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java
@@ -60,7 +60,7 @@ public class DnsLookupEndpointSpringTest extends
CamelSpringTestSupport {
void testDNSWithEmptyNameHeader() throws Exception {
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.name", "");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_NAME, "");
});
assertTrue(e.getCause() instanceof IllegalArgumentException,
e.toString());
resultEndpoint.assertIsSatisfied();
@@ -77,7 +77,7 @@ public class DnsLookupEndpointSpringTest extends
CamelSpringTestSupport {
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("dns.name", "www.example.com");
+ headers.put(DnsConstants.DNS_NAME, "www.example.com");
template.sendBodyAndHeaders("hello", headers);
resultEndpoint.assertIsSatisfied();
}
@@ -93,8 +93,8 @@ public class DnsLookupEndpointSpringTest extends
CamelSpringTestSupport {
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("dns.name", "www.example.com");
- headers.put("dns.type", "A");
+ headers.put(DnsConstants.DNS_NAME, "www.example.com");
+ headers.put(DnsConstants.DNS_TYPE, "A");
template.sendBodyAndHeaders("hello", headers);
resultEndpoint.assertIsSatisfied();
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointTest.java
index d522eae5c40e..4e23a2c91dbe 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointTest.java
@@ -69,7 +69,7 @@ public class DnsLookupEndpointTest extends CamelTestSupport {
void testDNSWithEmptyNameHeader() throws Exception {
resultEndpoint.expectedMessageCount(0);
Exception e = assertThrows(Exception.class, () -> {
- template.sendBodyAndHeader("hello", "dns.name", "");
+ template.sendBodyAndHeader("hello", DnsConstants.DNS_NAME, "");
});
assertTrue(e.getCause() instanceof IllegalArgumentException,
e.toString());
resultEndpoint.assertIsSatisfied();
@@ -86,7 +86,7 @@ public class DnsLookupEndpointTest extends CamelTestSupport {
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("dns.name", "www.example.com");
+ headers.put(DnsConstants.DNS_NAME, "www.example.com");
template.sendBodyAndHeaders("hello", headers);
resultEndpoint.assertIsSatisfied();
}
@@ -102,8 +102,8 @@ public class DnsLookupEndpointTest extends CamelTestSupport
{
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("dns.name", "www.example.com");
- headers.put("dns.type", "A");
+ headers.put(DnsConstants.DNS_NAME, "www.example.com");
+ headers.put(DnsConstants.DNS_TYPE, "A");
template.sendBodyAndHeaders("hello", headers);
resultEndpoint.assertIsSatisfied();
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java
index a5bfa200e4ab..ad1a714d80c9 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java
@@ -59,7 +59,7 @@ public class WikipediaEndpointSpringTest extends
CamelSpringTestSupport {
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("term", "monkey");
+ headers.put(DnsConstants.TERM, "monkey");
template.sendBodyAndHeaders(null, headers);
resultEndpoint.assertIsSatisfied();
}
diff --git
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java
index 3d7e2dee1a2f..dcfcb3f46311 100644
---
a/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java
+++
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java
@@ -68,7 +68,7 @@ public class WikipediaEndpointTest extends CamelTestSupport {
}
});
Map<String, Object> headers = new HashMap<>();
- headers.put("term", "monkey");
+ headers.put(DnsConstants.TERM, "monkey");
template.sendBodyAndHeaders(null, headers);
resultEndpoint.assertIsSatisfied();
}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
index b9aff77aa843..1ed0203c4040 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
@@ -485,6 +485,60 @@ The same pattern applies to HTTP-based bridges
(`platform-http`/`jetty`/`netty
-http`/`http` -> `cxf:`) and any other transport whose default
`HeaderFilterStrategy` filters `Camel*` headers.
+=== camel-dns
+
+The Exchange header constants in `DnsConstants` have been renamed to follow the
+Camel naming convention used across the rest of the component catalog. The Java
+field names are unchanged; only the header string values have changed:
+
+[options="header"]
+|===
+| Constant | Previous value | New value
+| `DnsConstants.DNS_CLASS` | `dns.class` | `CamelDnsClass`
+| `DnsConstants.DNS_NAME` | `dns.name` | `CamelDnsName`
+| `DnsConstants.DNS_DOMAIN` | `dns.domain` | `CamelDnsDomain`
+| `DnsConstants.DNS_SERVER` | `dns.server` | `CamelDnsServer`
+| `DnsConstants.DNS_TYPE` | `dns.type` | `CamelDnsType`
+| `DnsConstants.TERM` | `term` | `CamelDnsTerm`
+|===
+
+Routes that reference the constant symbolically (for example
+`setHeader(DnsConstants.DNS_SERVER, ...)`) continue to work without changes.
+Routes that set the header by its literal string value (for example
+`setHeader("dns.server", ...)` or `setHeader("term", ...)`) must be updated to
+use the new value:
+
+[source,java]
+----
+// before
+from("direct:start")
+ .setHeader("dns.name", constant("www.example.com"))
+ .setHeader("dns.type", constant("A"))
+ .to("dns:lookup");
+
+// after
+from("direct:start")
+ .setHeader("CamelDnsName", constant("www.example.com"))
+ .setHeader("CamelDnsType", constant("A"))
+ .to("dns:lookup");
+----
+
+==== Behaviour change: cross-transport propagation of dns.* headers
+
+Because the renamed header values now begin with `Camel`, they are filtered by
+the standard transport `HeaderFilterStrategy` (`JmsHeaderFilterStrategy`,
+`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 `dns:`
+producer and let the sender choose the DNS operation parameters via headers
+must therefore carry those parameters in non-`Camel`-prefixed application
+headers and map them to the corresponding `DnsConstants` value in the route
+between the transport `from` and the `dns:` `to`. Allowing untrusted senders
+to drive `DnsConstants.DNS_SERVER` (the recursive resolver target in
+`dns:dig`) without such a mapping step is not the intended use of the
+component.
+
=== camel-aws2-s3
The `listObjects` operation now uses the `ListObjectsV2` AWS API instead of
the deprecated `ListObjects` API.
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DnsEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DnsEndpointBuilderFactory.java
index 5d0d76347e55..23b563a7d727 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DnsEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DnsEndpointBuilderFactory.java
@@ -182,10 +182,10 @@ public interface DnsEndpointBuilderFactory {
*
* Group: lookup dig
*
- * @return the name of the header {@code dns.class}.
+ * @return the name of the header {@code DnsClass}.
*/
public String dnsClass() {
- return "dns.class";
+ return "CamelDnsClass";
}
/**
* The name to lookup.
@@ -195,10 +195,10 @@ public interface DnsEndpointBuilderFactory {
* Required: true
* Group: lookup
*
- * @return the name of the header {@code dns.name}.
+ * @return the name of the header {@code DnsName}.
*/
public String dnsName() {
- return "dns.name";
+ return "CamelDnsName";
}
/**
* The domain name.
@@ -208,10 +208,10 @@ public interface DnsEndpointBuilderFactory {
* Required: true
* Group: ip
*
- * @return the name of the header {@code dns.domain}.
+ * @return the name of the header {@code DnsDomain}.
*/
public String dnsDomain() {
- return "dns.domain";
+ return "CamelDnsDomain";
}
/**
* The server in particular for the query. If none is given, the
default
@@ -221,10 +221,10 @@ public interface DnsEndpointBuilderFactory {
*
* Group: dig
*
- * @return the name of the header {@code dns.server}.
+ * @return the name of the header {@code DnsServer}.
*/
public String dnsServer() {
- return "dns.server";
+ return "CamelDnsServer";
}
/**
* The type of the lookup. Should match the values of
@@ -234,10 +234,10 @@ public interface DnsEndpointBuilderFactory {
*
* Group: lookup dig
*
- * @return the name of the header {@code dns.type}.
+ * @return the name of the header {@code DnsType}.
*/
public String dnsType() {
- return "dns.type";
+ return "CamelDnsType";
}
/**
* The term.
@@ -247,10 +247,10 @@ public interface DnsEndpointBuilderFactory {
* Required: true
* Group: wikipedia
*
- * @return the name of the header {@code term}.
+ * @return the name of the header {@code DnsTerm}.
*/
- public String term() {
- return "term";
+ public String dnsTerm() {
+ return "CamelDnsTerm";
}
}
static DnsEndpointBuilder endpointBuilder(String componentName, String
path) {