Language and Page Formatting Options
Chapter 29. DNS
Available as of Camel 2.7
This is an additional component for Camel to run DNS queries, using DNSJava. The component is a thin layer on top of DNSJava. The component offers the following operations:
- To resolve a domain by its IP address.
- To look up information about the domain.
- To run DNS queries.
Requires SUN JVM
The DNSJava library requires running on the SUN JVM. If you use Apache ServiceMix or Apache Karaf, you'll need to adjust the
etc/jre.propertiesfile, to add
sun.net.spi.nameserviceto the list of Java platform packages exported. The server will need restarting before this change takes effect.
Maven users will need to add the following dependency to their
pom.xmlfor this component:
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-dns</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency>
The URI scheme for a DNS component is as follows
This component only supports producers.
||The domain name. Mandatory.|
||The name to lookup. Mandatory.|
The type of the lookup. Should match the values of
he DNS class of the lookup. Should match the values of
||The query itself. Mandatory.|
||The server in particular for the query. If none is given, the default one specified by the OS will be used. Optional.|
<route id="IPCheck"> <from uri="direct:start"/> <to uri="dns:ip"/> </route>
This looks up a domain's IP. For example, www.example.com resolves to 184.108.40.206. The IP address to lookup must be provided in the header with key
<route id="IPCheck"> <from uri="direct:start"/> <to uri="dns:lookup"/> </route>
This returns a set of DNS records associated with a domain. The name to lookup must be provided in the header with key
Dig is a Unix command-line utility to run DNS queries.
<route id="IPCheck"> <from uri="direct:start"/> <to uri="dns:dig"/> </route>
The query must be provided in the header with key