Mule CoAP connector - CoapClient. The CoapClient Connector can be used in Mule applications to implement CoAP clients as defined in rfc7252 . A CoAP client issues requests on resources that reside on a CoAP server. On these resources GET, POST, PUT, DELETE and Observer requests can be issued from Mule applications using this Connector. The client CoAP endpoint has a number of configuration parameters that can be used to tune behavior of the connector. Apart from host and port, these parameters have sensible defaults and need only to be set for specific needs.

Additional Info

Requires Mule Enterprise License

No  

Requires Entitlement

No  

Mule Version

3.8.0 or higher

Configs


Configuration

<coap-client:config>

Configuration The CoAP client configuration contains attributes defining the CoAP endpoint that is used to do CoAP requests.

Attributes

Name Java Type Description Default Value Required

name

String

The name of this configuration. With this name can be later referenced.

x 

host

String

The CoAP server hostname or ip address by which the server is reachable.

x 

port

Integer

The port the CoAP server is listening on.

 

secure

boolean

Flag indicating DTLS will be used to connect to the CoAP server.

false

 

logMessages

boolean

When true each CoAP message will be logged.

false

 

bindToHost

String

The hostname or IP address the CoAP client binds to. If none is given system default is used.

 

bindToPort

String

The port the CoAP client will bind to when secure == false.

 

bindToSecurePort

String

The port the CoAP client will bind to when secure == true.

 

ackTimeout

String

The acknowledgment timeout in milliseconds [ms])

2000

 

ackRandomFactor

String

 

ackTimeoutScale

String

 

maxRetransmit

String

 

exchangeLifetime

String

 

nonLifetime

String

 

maxTransmitWait

String

 

nstart

String

 

leisure

String

 

probingRate

String

 

keyStoreLocation

String

 

keyStorePassword

String

 

privateKeyAlias

String

 

trustStoreLocation

String

 

trustStorePassword

String

 

trustedRootCertificateAlias

String

 

useRandomMidStart

String

 

tokenSizeLimit

String

 

preferredBlockSize

String

 

maxMessageSize

String

 

blockwiseStatusLifetime

String

 

notificationCheckIntervalTime

String

 

notificationCheckIntervalCount

String

 

notificationReregistrationBackoff

String

 

useCongestionControl

String

 

congestionControlAlgorithm

String

 

protocolStageThreadCount

String

 

networkStageReceiverThreadCount

String

 

networkStageSenderThreadCount

String

 

udpConnectorDatagramSize

String

 

udpConnectorReceiveBuffer

String

 

udpConnectorSendBuffer

String

 

udpConnectorOutCapacity

String

 

deduplicator

String

 

deduplicatorMarkAndSweep

String

 

markAndSweepInterval

String

 

deduplicatorCropRotation

String

 

cropRotationPeriod

String

 

noDeduplicator

String

 

healthStatusPrintLevel

String

 

healthStatusInterval

String

 

Processors


Ping

<coap-client:ping>

The Ping messageprocessor checks whether a CoAP resource is reachable.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

host

String

The host to ping. Overrides the connector setting.

 

port

Integer

The port the host listens on. Overrides the connector setting.

 

Returns

Return Java Type Description

Boolean

true when ping was successful, otherwise false.


Discover

<coap-client:discover>

Discover message-processor retrieves information about CoAP resources from a server. The host and port are optional parameters that override Connector configuration

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true (default), requests are sent confirmable.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

queryParameters

List<String>

The optional query-parameters for discovery.

 

Returns

Return Java Type Description

Set

A Set of Weblinks describing the resources on the server. When the retrieval of the set of Weblinks failed, null is returned.


Get

<coap-client:get>

Get messageprocessor retrieves the contents of a CoAP resource from a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

Returns

Return Java Type Description

MuleEvent

On success the contents of the CoAP resource is returned in a byte array( byte[] ) as message payload.


Async get

<coap-client:async-get>

Async-Get messageprocessor asynchronously retrieves the contents of a CoAP resource from a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

responseHandler

String

Name of the handler that will process the returned response.

x 

Returns

Return Java Type Description

MuleEvent

The MuleMessage is returned unchanged.


Put

<coap-client:put>

Put messageprocessor changes the contents of a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

Returns

Return Java Type Description

MuleEvent

On success the response payload - if any - is returned in a byte array( byte[] ) as message payload.


Async put

<coap-client:async-put>

Async-Put messageprocessor asynchronously changes the contents of a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

responseHandler

String

Name of the handler that will process the returned response.

x 

Returns

Return Java Type Description

MuleEvent

The MuleMessage is returned unchanged.


Post

<coap-client:post>

Post messageprocessor delivers contents to a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

Returns

Return Java Type Description

MuleEvent

On success the response payload - if any - is returned in a byte array( byte[] ) as message payload.


Async post

<coap-client:async-post>

Async-Put messageprocessor asynchronously delivers contents to a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

responseHandler

String

Name of the handler that will process the returned response.

x 

Returns

Return Java Type Description

MuleEvent

The MuleMessage is returned unchanged.


Delete

<coap-client:delete>

Delete messageprocessor deletes a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

Returns

Return Java Type Description

MuleEvent

On success the response payload - if any - is returned in a byte array( byte[] ) as message payload.


Async delete

<coap-client:async-delete>

Async-Delete messageprocessor asynchronously deletes a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true the server must confirm the request.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

responseHandler

String

Name of the handler that will process the returned response.

x 

Returns

Return Java Type Description

MuleEvent

The MuleMessage is returned unchanged.


Start observe

<coap-client:start-observe>

Start-observe messageprocessor dynamically initiates observation of a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

confirmable

Boolean

When true (default), requests are sent confirmable.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

responseHandler

String

Name of the handler that will process the resource updates received from server.

x 


Stop observe

<coap-client:stop-observe>

Stop-observe messageprocessor ends a dynamically set observation of a CoAP resource on a Server. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 


List observations

<coap-client:list-observations>

List-Observations messageprocessor retrieves the list of active dynamic observations on a CoAP resource. The list contains the CoAP resource url that is being observed dynamically.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

Returns

Return Java Type Description

List<String>

The List of urls of active dynamic observations.

Sources


Observe

<coap-client:observe>

Observe messagesource observes a CoAP resource on a Server. The observation is static - meaning the observation will be active as long as the Mule-flow is running. The resource url can be set, overriding connector configuration.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

callback

SourceCallback

x 

confirmable

Boolean

When true (default), requests are sent confirmable.

true

 

host

String

The host address of the server.

 

port

Integer

The port the server is listening on.

 

path

String

The path of the resource.

x 

queryParameters

List<String>

List of query parameters.

 

Returns

Return Java Type Description

void

Updates on the resource the server sends are returned as a MuleMessage.


Handle response

<coap-client:handle-response>

Handle-Response messagesource handles responses on asynchronous requests that reference this handler. The Handler can process the responses of multiple requests and it the type of requests can differ. So one Handler could be used to process responses to asynchronous Get, Put, Post, Delete or Observe requests.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

callback

SourceCallback

x 

handlerName

String

The name of the hander. Used by asynchronous requests to reference the handler.

x 

Returns

Return Java Type Description

void

Responses on asynchronous requests are returned as a MuleMessage.