Integration & Gateways · Study deck

Practice: Gateway Protocol Translation

Picture a freezer reading that crosses a bridge but loses its unit and original time.

Gateway Gus is your guide for this deck.

communicationprotocolbridging
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Build a source-to-target mapping record for a gateway translation path.
  • Normalize source samples while preserving unit, timestamp, quality, and identity.
  • Choose target routes and delivery expectations for telemetry, state, and command paths.
  • Define queue behavior for ordinary messages, critical messages, stale messages, and malformed messages.
iotclass.org

Major section

In 60 Seconds · Start With the Story

The target receives a number that it cannot safely interpret.

  • A gateway means the boundary system that connects local devices to another network or service.
  • Telemetry means records a system sends about readings, state, and health.
  • This runway does not prove that every bridge or target is correct.
iotclass.org

Major section

Lab Scenario · Lab Workbench

You can complete it with a spreadsheet, notes, a local script, or a gateway configuration review.

  • You are reviewing a gateway that bridges local equipment readings into a target event route.
  • Source sample Do Evidence.
  • unit=7 register=40019 timeout Do not publish a stale value as fresh.
One spine — source sample, point map, normalized message, queue policy, target route, evidence record — carries a good reading, a state change, and a timeout to three different evidence records.
One spine — source sample, point map, normalized message, queue policy, target route, evidence record — carries a good reading, a state change, and a timeout to three different evidence records.

Try it: Lab Scenario · Lab Workbench in the chapter

iotclass.org

Major section

Exercise 3: Choose the Target Route · Command Path Warning

Target routes are a contract.

  • A route should be stable, authorized, and specific enough for consumers to subscribe without broad catch-all filters.
  • Route family Do Evidence.
  • Telemetry Use a stable hierarchy with site, system, asset, and point.
  • Command Require identity, authorization, audit record, and timeout rule before writing to a source-side device.

Try it: Exercise 3: Choose the Target Route · Command Path Warning in the chapter

iotclass.org

Major section

Lab Review Record · Source Evidence

Your final deliverable is the review record.

  • It should fit on one page and link every decision to evidence.
  • The relationship between “Source” and “Raw evidence” is what makes Gateway protocol translation lab record showing source evidence, mapping evidence, delivery evidence, failure evidence, and release decision reviewable.
Gateway protocol translation lab record showing source evidence, mapping evidence, delivery evidence, failure evidence, and release decision.
Gateway protocol translation lab record showing source evidence, mapping evidence, delivery evidence, failure evidence, and release decision.

Try it: Lab Review Record · Source Evidence in the chapter

iotclass.org

Major section

Overview: Translation Includes Delivery Semantics, Not Just Format

A protocol gateway is easy to underestimate as a format converter - reshape the bytes and change the addressing.

  • The hard part is that protocols also differ in what they promise about delivery.
  • One side may hold a message until an acknowledgment arrives; the other may discard it after one send attempt.

Key terms

Names
Names are the easy part.

Why it matters

A source that reports temperature as an integer in tenths of a degree and a target that expects a floating-point degree value will silently disagree by a factor of ten unless the contract says otherwise.

One spine — source sample, point map, normalized message, queue policy, target route, evidence record — carries a good reading, a state change, and a timeout to three different evidence records.
One spine — source sample, point map, normalized message, queue policy, target route, evidence record — carries a good reading, a state change, and a timeout to three different evidence records.
iotclass.org

Major section

Overview: Translation Includes Delivery Semantics, Not Just Format (continued)

Intuition only: a gateway can only pass along the reliability it is actually given.

  • Bridging the bytes while ignoring those delivery semantics quietly changes the reliability of the whole path, usually for the worse.
  • A gateway therefore needs an explicit translation contract that maps not just field names but units, encodings, and delivery semantics.
  • Encoding and units Field types, scales, endianness, and timestamp formats, so a value keeps its meaning.
iotclass.org

Major section

Overview: Translation Includes Delivery Semantics, Not Just Format (continued)

For example, a Modbus RTU meter on RS-485 might expose register 40017 = 214 with a stale or failed read flag.

  • A Node-RED, Telegraf, or custom Python gateway might turn that into MQTT topic site-a/mechanical/boiler-1/return-air-temperature or an HTTP event for a cloud API.
  • The lab record must show whether 214 becomes 21.4 C, which source timestamp is kept, which map version made the decision, and whether the target sees good, stale, or bad_quality.
  • Failure evidence Queue depth, retries, and drops recorded so a translation failure is visible, not silent.
iotclass.org

Major section

Practitioner: Chain The Acknowledgment To Preserve Reliability

To preserve at-least-once behavior across a bridge, the gateway must not acknowledge the source until the target has committed.

  • Worked Example: Bridge MQTT QoS 1 To An HTTP Endpoint The source publishes with MQTT QoS 1 (at-least-once): the broker keeps redelivering until the gateway sends its acknowledgment.
  • If the POST fails, do not acknowledge; the broker will redeliver and the gateway retries.
  • The important part is not the tool brand.

Why it matters

Pair it with an idempotency key so that retries do not create duplicates.

iotclass.org

Major section

Practitioner: Chain The Acknowledgment To Preserve Reliability (continued)

The trap: if the gateway acknowledges the MQTT message immediately and then the POST fails, the message is gone - the path has been silently downgraded from at-least-once to at-most-once.

  • The duplicate risk: a POST that succeeded but whose response was lost will be retried, so the cloud may see the same record twice.
  • With acknowledgment chaining plus idempotency, the bridge preserves at-least-once behavior end to end and avoids duplicates, instead of quietly weakening the delivery contract.
  • For HTTP, capture endpoint, status code, timeout, retry limit, idempotency key header, and the response body that proves acceptance.
iotclass.org

Major section

Under The Hood: Reliability Is End To End, Not Per Hop

MQTT QoS 2 provides exactly-once delivery, but only between an MQTT client and its broker; it says nothing about a bridge from the broker to a different protocol.

  • The deepest principle of bridging is that delivery behavior is a property of the whole path, not of any single leg.
  • Under the hood, the gateway usually needs a small durable outbox.
  • A durable target does not fix an unreliable source.

Key terms

Delivery behavior
Delivery behavior is end to end, and QoS 2 covers only the MQTT hop.
iotclass.org

Major section

Under The Hood: Reliability Is End To End, Not Per Hop (continued)

Without that record, a process restart between source acknowledgment and target commit can lose the only copy of the message.

  • And a gateway can destroy reliability it was given, by acknowledging one side before the other side has committed - a reliability air gap right in the middle of a nominally reliable path.
  • Achieving exactly-once behavior across a gateway requires idempotency at the final sink - a deduplicating key that makes reprocessing a repeated message harmless - not merely selecting the strongest QoS on one leg.
  • The bridge also needs a clear boundary between data-quality failure and delivery failure.
iotclass.org

Major section

Under The Hood: Reliability Is End To End, Not Per Hop (continued)

The outbox records source id, source timestamp, mapping version, normalized payload hash, target route, target attempt count, last error, and final disposition.

  • With it, the gateway can resume after restart, resend unfinished target attempts, and show which messages were accepted, rejected, expired, or dead-lettered.
  • A Modbus timeout or BACnet fault value is not the same as a failed MQTT publish or HTTP 503 response.
  • The first should become a target-visible quality state tied to the source observation.
  • The second should stay in queue or retry state tied to transport delivery.
iotclass.org

Deck summary

Key takeaways

The target receives a number that it cannot safely interpret.

  • You can complete it with a spreadsheet, notes, a local script, or a gateway configuration review.
  • Target routes are a contract.
  • Your final deliverable is the review record.
  • A protocol gateway is easy to underestimate as a format converter - reshape the bytes and change the addressing.
iotclass.org

Retrieval practice

Recall check 1 of 6

Gateway Gus says: answer from memory, then check your reasoning.

Q1In the gateway translation lab, a source read times out for a mapped point. What is the best gateway behavior?

APublish bad quality with retry count and timeout evidence
BPublish the prior value with a fresh timestamp and hide the timeout
CDrop this point for the cycle and leave no timeout record
DStop unrelated gateway routes until this register responds
Show answer

Answer: A A timed-out source read should publish a missing or bad-quality state with retry and last-good evidence, not a fabricated value.

iotclass.org

Retrieval practice

Recall check 2 of 6

Gateway Gus says: answer from memory, then check your reasoning.

Q2Place each gateway-lab artifact where it lives so you can prove the bridge preserves source meaning through translation and delivery.

ASource sample
BPoint map
CNormalized message
DQueue policy
ETarget route
Show answer

Answer: A Trace one source sample through its semantic map and queue policy to the target route so you can diagnose loss, staleness, or mistranslation.

iotclass.org

Retrieval practice

Recall check 3 of 6

Gateway Gus says: answer from memory, then check your reasoning.

Q3During the lab, a source read times out for a mapped point. What is the best gateway behavior?

APublish the last known value with the current gateway time
BRecord bad quality, retry count, last-good time, and timeout evidence
CDelete the point mapping before the next source poll
DIgnore the sample and keep the failure out of the log
Show answer

Answer: B The review record should show timeout behavior, retry count, last-good timestamp, and the target-visible quality state.

iotclass.org

Retrieval practice

Recall check 4 of 6

Gateway Gus says: answer from memory, then check your reasoning.

Q4Beyond converting byte formats, what must a protocol gateway also translate to avoid quietly changing a system's behavior?

ADelivery semantics and units: ack timing and value scaling.
BOnly field names; timing and value scale transfer without mapping.
CNothing else; converted bytes preserve system behavior by themselves.
DOnly the encryption keys used by the two protocol endpoints.
Show answer

Answer: A Protocols differ in delivery behavior and value encoding.

iotclass.org

Retrieval practice

Recall check 5 of 6

Gateway Gus says: answer from memory, then check your reasoning.

Q5A gateway bridges MQTT QoS 1 to an HTTP endpoint. To preserve at-least-once behavior, when should it acknowledge the incoming MQTT message?

AAfter HTTP commit, with an idempotency key
BImmediately on receipt, before trying the HTTP POST to the target
CNever acknowledge, so the broker redelivers every message forever
DAfter a fixed timer, regardless of the HTTP response result
Show answer

Answer: A Acknowledgment chaining preserves reliability: by withholding the MQTT ack until the downstream commit, a failure triggers redelivery instead of silent loss.

iotclass.org

Retrieval practice

Recall check 6 of 6

Gateway Gus says: answer from memory, then check your reasoning.

Q6An engineer sets MQTT QoS 2 on the source leg and assumes the cloud will therefore receive each record exactly once through the gateway. Why is that assumption wrong?

AQoS 2 covers only the MQTT hop; the sink still needs idempotency
BQoS 2 is disabled whenever a protocol gateway is present
CQoS 2 automatically deduplicates every cloud target record
DExactly-once behavior is impossible in any gateway design
Show answer

Answer: A Delivery behavior is end to end, and QoS 2 covers only the MQTT hop.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. A · A timed-out source read should publish a missing or bad-quality state with retry and last-good evidence, not a fabricated value.
  2. A · Trace one source sample through its semantic map and queue policy to the target route so you can diagnose loss, staleness, or mistranslation.
  3. B · The review record should show timeout behavior, retry count, last-good timestamp, and the target-visible quality state.
  4. A · Protocols differ in delivery behavior and value encoding.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. A · Acknowledgment chaining preserves reliability: by withholding the MQTT ack until the downstream commit, a failure triggers redelivery instead of silent loss.
  2. A · Delivery behavior is end to end, and QoS 2 covers only the MQTT hop.
iotclass.org