Skip to content

Latest commit

 

History

History
83 lines (61 loc) · 2.66 KB

coap-component.adoc

File metadata and controls

83 lines (61 loc) · 2.66 KB

CoAP

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>

Usage

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.

Configuring the CoAP producer request method

The following rules determine which request method the CoAP producer will use to invoke the target URI:

  1. The value of the CamelCoapMethod header

  2. GE if a query string is provided on the target CoAP server URI.

  3. POST if the message exchange body is not null.

  4. GET otherwise.

spring-boot:partial$starter.adoc