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 |
The name of this configuration. With this name can be later referenced. |
x |
||
host |
The CoAP server hostname or ip address by which the server is reachable. |
x |
||
port |
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 |
The hostname or IP address the CoAP client binds to. If none is given system default is used. |
|
||
bindToPort |
The port the CoAP client will bind to when secure == false. |
|
||
bindToSecurePort |
The port the CoAP client will bind to when secure == true. |
|
||
ackTimeout |
The acknowledgment timeout in milliseconds [ms]) |
2000 |
|
|
ackRandomFactor |
|
|||
ackTimeoutScale |
|
|||
maxRetransmit |
|
|||
exchangeLifetime |
|
|||
nonLifetime |
|
|||
maxTransmitWait |
|
|||
nstart |
|
|||
leisure |
|
|||
probingRate |
|
|||
keyStoreLocation |
|
|||
keyStorePassword |
|
|||
privateKeyAlias |
|
|||
trustStoreLocation |
|
|||
trustStorePassword |
|
|||
trustedRootCertificateAlias |
|
|||
useRandomMidStart |
|
|||
tokenSizeLimit |
|
|||
preferredBlockSize |
|
|||
maxMessageSize |
|
|||
blockwiseStatusLifetime |
|
|||
notificationCheckIntervalTime |
|
|||
notificationCheckIntervalCount |
|
|||
notificationReregistrationBackoff |
|
|||
useCongestionControl |
|
|||
congestionControlAlgorithm |
|
|||
protocolStageThreadCount |
|
|||
networkStageReceiverThreadCount |
|
|||
networkStageSenderThreadCount |
|
|||
udpConnectorDatagramSize |
|
|||
udpConnectorReceiveBuffer |
|
|||
udpConnectorSendBuffer |
|
|||
udpConnectorOutCapacity |
|
|||
deduplicator |
|
|||
deduplicatorMarkAndSweep |
|
|||
markAndSweepInterval |
|
|||
deduplicatorCropRotation |
|
|||
cropRotationPeriod |
|
|||
noDeduplicator |
|
|||
healthStatusPrintLevel |
|
|||
healthStatusInterval |
|
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 |
Specify which config to use |
x |
||
host |
The host to ping. Overrides the connector setting. |
|
||
port |
The port the host listens on. Overrides the connector setting. |
|
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 |
Specify which config to use |
x |
||
confirmable |
When true (default), requests are sent confirmable. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
queryParameters |
The optional query-parameters for discovery. |
|
Returns
Return Java Type | Description |
---|---|
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
List of query parameters. |
|
||
responseHandler |
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
List of query parameters. |
|
||
responseHandler |
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
List of query parameters. |
|
||
responseHandler |
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
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 |
Specify which config to use |
x |
||
confirmable |
When true the server must confirm the request. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
List of query parameters. |
|
||
responseHandler |
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 |
Specify which config to use |
x |
||
confirmable |
When true (default), requests are sent confirmable. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
List of query parameters. |
|
||
responseHandler |
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.
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 |
Specify which config to use |
x |
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 |
Specify which config to use |
x |
||
callback |
SourceCallback |
x |
||
confirmable |
When true (default), requests are sent confirmable. |
true |
|
|
host |
The host address of the server. |
|
||
port |
The port the server is listening on. |
|
||
path |
The path of the resource. |
x |
||
queryParameters |
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 |
Specify which config to use |
x |
||
callback |
SourceCallback |
x |
||
handlerName |
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. |