Since Camel 2.16
Both producer and consumer are supported
Camel-CoAP is an Apache Camel component that allows you to work with CoAP, a lightweight REST-type protocol for machine-to-machine operation. CoAP, Constrained Application Protocol is a specialized web transfer protocol for use with constrained nodes and constrained networks, and it is based on RFC 7252.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-coap</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
Camel supports the DTLS, TCP and TLS protocols via the following URI schemes:
Scheme | Protocol |
---|---|
coap |
UDP |
coaps |
UDP + DTLS |
coap+tcp |
TCP |
coaps+tcp |
TCP + TLS |
There are a number of different configuration options to configure TLS. For both DTLS (the "coaps" uri scheme) and TCP + TLS (the "coaps+tcp" uri scheme), it is possible to use a "sslContextParameters" parameter, from which the camel-coap component will extract the required truststore / keystores etc. to set up TLS. In addition, the DTLS protocol supports two alternative configuration mechanisms. To use a pre-shared key, configure a pskStore, and to work with raw public keys, configure privateKey + publicKey objects.
The following rules determine which request method the CoAP producer will use to invoke the target URI:
-
The value of the
CamelCoapMethod
header -
GE
if a query string is provided on the target CoAP server URI. -
POST
if the message exchange body is not null. -
GET
otherwise.
spring-boot:partial$starter.adoc