Queue Mode

Last modified: May 23, 2019 @ 08:24

Overview

Queue Mode allows messages to be queued when devices are offline or unreachable. DDM implements one queue per device.

Queue Mode has an impact on all messages sent from DDM to a device. Messages sent to the gateway are not affected.

To view the queue associated with a device:

  1. From a location, click to select a device with a smart object.
  2. The Request Queue is displayed on the Device page.

Terminology

  • Queued: Message request is still queued in DDM and has not been sent to the device. Corresponds to Pending in the Activity Log.
  • In-flight: Message request is sent to the device but no response has been received yet. Corresponds to In progress in the Activity Log.

Features

Device Status

Devices can have the following statuses, marked by a corresponding colour in device lists and device details view.

  • Never Activated : Gray
  • Online : Green
  • Deactivated/Offline : Red

Offline/Online

Offline Device: No new requests will be sent from DDM to an offline gateway and/or device until the device goes online again.

Online Device: Devices are online when DDM receives communication from the device. There is a specific message to signal online status, but the device will be set to online in DDM as soon as any kind of message is received from the device.

Sync/Async

Async: Sends several message requests to the device at once, does not wait for a response before sending the next one.

Sync: Sends a message request that is blocking, i.e. waits for a response from the device before sending the next message.

Duplicate Message Detection

If two requests of same kind (read, write, etc.) are sent to the same resource with the same content, the next request is rejected as a duplicate and the expiration time of the first request is extended.

Precondition: The first request has status Queued or In-flight. No other request of a different kind or with different content is created after the first request.

  1. From a Location on the Dashboard, click to select a smart object.
  2. Click a resource to expand it and view the activity log.
  3. Duplicate messages that are detected are recorded in the Activity Log for the Resource.

Intermediate Queue on LwM2M Gateway

This is a queue on the LwM2M Gateway that guarantees the order of the requests to be sent to each device. Without intermediate queuing, requests are handled in parallel.

Messages need to be queued when a Device sleeps and cannot receive messages. The LwM2M Gateway queues a maximum of 50 messages per Device. The gateway rejects new message requests from DDM if the queue is full. In this case, an error response is sent back to DDM, and DDM stores the message in its own queue as described above.

When the Device wakes up and updates its registration, the LwM2M Gateway sends the queued messages to the Device. The process consists of the following steps:

  1. Device wakes up.
  2. Device sends registration update.
  3. Gateway sends queued messages to Device.
  4. After the Device replies, the responses will be sent to DDM.

The Queue Mode operation on the Gateway is enabled for all client devices, regardless of the LwM2M binding mode provided by the client. See  https://github.com/eclipse/leshan/pull/265This function is always enabled.

Intermediate Queue on non-LwM2M Gateway

A Gateway guarantees communication between Devices and DDM. Depending on protocol type, this communication can be synchronous, like in LwM2M, or asynchronous.

Whether messages are queued on the Gateway depends on the specific inplementation of the Gateway. DDM sends messages to a specific Device, through the Gateway, as long as the Device is marked as registered in DDM. If this is not possible, messages are queued in DDM.

Resend all Messages

The gateway can send a request to DDM to resend all messages currently in-flight.

Configuration

The following configurations can be made:

Set Max In-Flight Message Count for the Device Queue

This configuration sets the maximum number of messages that are In-Flight at any given time. In-Flight messages have been sent to the gateway and are awaiting response.

  1. Click to select a location.
  2. In the Devices section, click on the name of a device. The Device page opens.
  3. Click Edit (a pencil icon) in the Device Message Queue section. The Device Settings window opens.

Note: If the Device Message Queue section is missing, see Setting Category for instructions. Choose the setting category Device Message Queue.

  1. In the row for Max In-Flight Message Count, in the Value column, fill in the maximum number of in-flight messages.
  2. Click Save. The Device Settings window closes and the Max In-Flight Message Count updates in the Device Message Queue section.

Note: If the number of in-flight message already exceeds the new setting (for example, if this setting is changed while the gateway is offline), the messages currently in-flight will retain that status until the device is back online. Further messages appear in the queue with the status Queued.

Set Max Device Queue Size

This configuration sets the maximum number of queued messages for a device.

  1. Click to select a location.
  2. Click Edit (a pencil icon) in the Device Message Queue section. The Device Settings window opens.
  3. In the row for Max Queue Size, in the Value column, fill in the maximum number of messages that will be queued.
  4. Click Save. The Device Settings window closes and the Max Queue Size updates in the Device Message Queue section.

Set Device Queue Message Expiration Time

This configuration sets an expiration time for queued messages. Expired messages disappear from the queue when the expiration time has passed.

  1. Click to select a location.
  2. Click Edit (a pencil icon) in the Device Message Queue section. The Device Settings window opens.
  3. In the row for Message Expiration Time, in the Value column, fill in the number of milliseconds that the message will remain before expiring. For example, 2 minutes is entered as 120000.
  4. Click Save. The Device Settings window closes and the queue size updates in the Device Message Queue section.

Set Device Queue Message Priority to Synchronous or Asynchronous

This configuration sets the behavior of the queue to Synchronous or Asynchronous.

Synchronous Requests

  • ON: The device confirms that the previous resource request has been handled before sending the next resource request.
  • OFF: All incoming requests are sent to the device simultaneously, even if a response to the previous request has not been received. This is sometimes referred to as Asynchronous, or Async.
  1. Click to select a location.
  2. In the Smart Objects section, click to turn Synchronous Requests ON or OFF.

Send Message Async by Default

This configuration sets the default behavior of the queue to Synchronous or Asynchronous.

  1. Click to select a location.
  2. Click Edit (a pencil icon) in the Device Message Queue section. The Device Settings window opens.
  3. In the row for Send Messages Async By Default, turn the button ON or OFF as desired.
  4. Click Save. The Device Settings window closes and the queue size updates in the Device Message Queue section.

Delete Messages from the Device Queue

This configuration deletes queued messages.

  1. Click to select a location.
  2. Click the trashcan icon on the same row as a message in the Request Queue section. The message disappears from the queue.