Guia QoS

Escolha o contrato de entrega antes do número.

QoS depende de retry, duplicidade e valor da mensagem.

Guia QoS

Escolha o contrato de entrega antes do número.

QoS depende de retry, duplicidade e valor da mensagem.

PUBLISH

No máximo uma vez

Entrega sem confirmação para telemetria frequente em que a próxima leitura vale mais que retry.

  • ConfirmaçõesNenhuma
  • Custo de redeMais baixo
  • Melhor usoFluxos de sensores

Escolha QoS por retry, duplicidade, latência e valor da mensagem.

Decision model

QoS is an operations choice before it is a protocol number.

QoS 0, 1, and 2 trade latency, acknowledgements, retry behavior, and broker work. The right choice depends on how expensive message loss or duplication is for a specific topic.

  • QoS 0 for frequent telemetry that can be replaced by the next sample
  • QoS 1 for commands and alerts where duplicates are acceptable
  • QoS 2 for rare state changes where duplicates are costly
  • Mix QoS levels by topic instead of choosing one globally
Consumer behavior

Design consumers for the QoS level you choose.

QoS 1 can deliver duplicates, so consumers should be idempotent. QoS 2 reduces duplicates at the protocol layer but still requires durable application logic for real systems.

  • Use message IDs or state versioning
  • Make command handlers idempotent
  • Record processed events when side effects matter
  • Test disconnect and reconnect behavior
Cost

Higher QoS increases network and broker work.

Every acknowledgement has a cost. On mobile, satellite, battery-powered, or high-frequency telemetry networks, unnecessary QoS can reduce throughput and increase energy usage.

  • Measure latency with realistic networks
  • Do not use QoS 2 for every telemetry point
  • Document topic-level QoS expectations
  • Test retained and queued messages separately