OBLYTECH Logo
OBLYTECH Logo

Queued Delivery for Devices With Intermittent Connectivity

Queued delivery lets a device with intermittent connectivity collect its messages after it reconnects, rather than needing to be online when each message is sent. Each device gets its own queue. Much of the design work then sits in storage limits, ordering after reconnection, and critical messages sent while the device is offline.

How a queue holds messages for a device that drops offline

In a queuing pattern, a producer sends a message to a queue, and the queue keeps it until a subscriber retrieves it. The producer does not need to know whether the device is online at the moment it sends. That separation is why queues suit field teams, sensors and handheld units that lose signal in basements, rural routes or warehouse aisles.

A live push behaves differently. If the device is offline when the message goes out, the message is lost unless the sender retries, which ties the sender to the device’s connection state. A queue moves that burden into the messaging layer. The device connects later, opens its queue and works through whatever is waiting.

Retrieval also changes the queue’s contents. Many queue implementations use first-in, first-out ordering and delete a message once it has been retrieved. On a platform that deletes a message at retrieval, a device that reads a message and then loses power before it saves the content has no copy left in the queue. Check how your platform handles acknowledgment before you treat a retrieved message as safe.

Setting up one queue per device

A shared queue is simpler to configure, but it makes delivery tracking harder. When several devices draw from one queue, it is harder for the sender to tell which device received which message. A queue per subscriber costs more setup work, yet it lets you confirm delivery to a specific device and review that device’s history on its own.

Provisioning a queue when the device is registered

Create the queue when the device record is created, not when the first message is sent. Otherwise early messages can go to a destination that nothing reads. Tie the queue name to a stable device identifier rather than to a person. Devices change hands, and a queue named after a user breaks when the handset is reassigned.

Controlling who can publish to a device queue

Limit publishing rights to the integration user or the service that owns each message type. Publishers that write to device records need access to those records, so review the permission set the integration user holds before go-live. For keeping that access narrow, see our notes on permission set design for small teams.

Validation rules on the device object can also reject an update the device needs to save. Test each rule against the integration’s payloads, not just against manual edits. For the details, see our notes on validation rules that do not break integrations.

Sizing storage and retention for queued messages

A queue needs memory or storage for its contents, so it cannot grow without limit. A device that stays offline for days can fill its queue. Depending on the platform, a full queue then rejects new publishes or drops messages. Calculate the storage requirement before launch rather than after the first complaint.

Start with three inputs: the average message size, the number of messages a device can accumulate during its longest expected offline period, and the number of devices that share a message type. Multiply them and compare the result with the platform’s limits. Use the longest realistic offline period in the calculation. A depot device rarely goes dark, while a device on a route with no coverage can build a backlog daily.

Setting purge rules for stale messages

Decide what happens to messages that wait too long. A time-based rule removes messages older than a set age. A volume rule stops a queue from accepting new messages once it reaches a set count. Record the rule in the requirements document so administrators know which messages are removed and why. Removing old data is a business call, because a price update from last week and a work order from last week carry different weight.

Backlog draining also runs into the limits that apply to bulk processing. A device that reconnects after a long gap can send a large batch at once. For the ceilings that affect that kind of work, see our notes on governor limits for admins.

Handling messages that arrive after a device reconnects

A reconnecting device can find a backlog whose contents no longer match the current state of its records. Many queues preserve send order, but the device still has to decide what to do with an instruction that refers to a record that has since changed. Write the device logic on the assumption that a backlog may include stale instructions.

Checking sequence or timestamp before applying a change

Include a sequence number or a last-modified timestamp in each message. Before applying an update, compare that value with the version the device already holds. Skip or flag any message older than the stored record. Without this check, a reconnecting device can overwrite a newer status with an older one, and the mismatch may surface when someone compares the two records later.

Keeping related message types in one queue

Order is generally preserved within a single queue but not across queues. If one message type goes to one queue and a related type goes to another, the device may process a close-out before the assignment it depends on. Keep related types together when their order matters, and accept the throughput cost of a shared queue in exchange.

Acknowledging after the local save

If the platform removes a message as soon as the device reads it, a power loss between reading and saving loses that message. Where the platform supports acknowledging after processing, acknowledge after the local save succeeds. If the save fails, leave the message in the queue so the device can try again.

Protecting critical messages sent while a device is offline

Queues have a gap that design reviews often miss. If a publisher sends a critical message while no subscriber is online, that message may fail to reach its target. A queue absorbs short outages, but it does not replace a plan for messages the business cannot lose.

Two mitigations are common. Replay keeps a record of published messages so that a device which missed them can request them again. Redundancy runs more than one subscriber for critical messages, with each on separate infrastructure, so a failure on one path does not take the message with it. Use replay when the device can ask for its history, and redundant subscribers when it cannot.

Deciding which messages count as critical

List each message type in the integration and label it as a convenience update or a message the business cannot lose. A stock level refreshed hourly is a convenience update. A safety inspection result or a payment instruction is not. Apply replay or redundancy to the second group. Applying it to the first group adds storage and processing load for little benefit.

Testing reconnection before go-live

Test the scenario the design exists for: a device goes offline, the publisher sends a mix of routine and critical messages, and the device reconnects later. Record what arrives, in what order, and what the device does with each one. Run the test in a sandbox configured like production, and schedule it around your refresh cycle so a refresh does not remove the records you still need to review. For background on that timing, see our notes on sandbox refresh planning.

A test sequence for one device

  1. Take the test device offline in a controlled way, such as switching off its network connection.
  2. Publish a batch of routine messages and two critical messages, and log the send time of each.
  3. Bring the device back online and let it drain its queue without manual intervention.
  4. Compare what the device stored with the send log, checking both the count and the order.
  5. Repeat with a backlog large enough to trigger the purge rule, and confirm the removed messages are the ones you expected.

Then run the same sequence with two devices reading from the same integration. The goal is to confirm that one device’s backlog does not delay the other.

For help planning this work, see Salesforce implementation.

Questions about queued delivery for field devices

Who should own queue settings after go-live?

Name one administrator and one developer as owners, and record the retention rules alongside the queue configuration. Route changes through the same change process you use for other integration settings, because a change to a queue affects all devices that subscribe to it.

How can I tell that a device has caught up with its backlog?

Compare the last sequence number the device processed with the newest sequence number the publisher has sent. A gap means messages are still waiting to be applied. Report that gap on the device’s record so support staff can see the backlog without opening the queue.

Is queued delivery worth it for devices that stay connected?

Often not. Retrieval through a queue adds delay between publishing and processing. A device that stays online and handles messages quickly may do better with direct delivery, and the queue is best kept for the devices that spend real time offline.

What should operations staff know before a queue is purged?

Give them the message types that the purge rule removes, the age or volume threshold that triggers removal, and the date the rule took effect. Ask them to confirm that no critical message type falls inside the removal scope before the rule runs.