^^MQTT message system, com protocol, client-server publish/subscribe.

wp

Storia del nome

MQTT  Message Queue Telemetry Transport  origine storica, non piu' adottata.
No queues, in spite of the name. Trasporta di tutto, non solo telemetria.

 

Per fissare le idee, consideriamo la situazione concreta

 

MQTT, sistema informatico, cerca di soddisfare tali esigenze.
"MQTT" nel parlato comune puo' riferirisi a molte cose, e quindi essere sorgente di confusione, specialmente per i principianti.

Sistema informatico di comunicazione MQTT

costituito da

  1. protocollo MQTT
  2. sw client-server MQTT

A user of a MQTT-server can both  produce and receive data
by both publishing and subscribing,

being both a client-publisher and a client-subscriber.
es: a sensor can publish sensor data and subscribe the configuration information or control commands.

Note: The original term was "broker" but it has now been standardized as "server" ( 2020); you will see both terms used. ref: http://www.steves-internet-guide.com/mqtt/

Protocollo MQTT Version 3.1.1  10 December 2015

Oasis standard mqtt-v3.1.1

Presentazione, Adapted from the Abstract:

MQTT  communication protocol for messages.

  1. Client-Server & publish/subscribe message pattern, provides
  2. agnostic to the content of the payload.
  3. 3 qualities of service (QoS) for message delivery:
    1. "At most once", where messages are delivered according to the best efforts of the operating environment. Message loss can occur. This level could be used, for example, with ambient sensor data where it does not matter if an individual reading is lost as the next one will be published soon after.
    2. "At least once", where messages are assured to arrive but duplicates can occur.
    3. "Exactly once", where message are assured to arrive exactly once. This level could be used, for example, with billing systems where duplicate or lost messages could lead to incorrect charges being applied.
  4. small transport overhead, protocol exchanges minimized, to reduce network traffic.
  5. A mechanism to notify interested parties when an abnormal disconnection occurs.
  1. used to build message middleware
  2. MQTT is a bi-directional communication protocol.

1.1 Organization of MQTT

This specification is split into seven chapters:

  1. Chapter 1 - Introduction
  2. Chapter 2 - MQTT Control Packet format
  3. Chapter 3 - MQTT Control Packets
  4. Chapter 4 - Operational behavior
  5. Chapter 5 - Security
  6. Chapter 6 - Using WebSocket as a network transport
  7. Chapter 7 - Conformance Targets

1.2 Terminology

Network Connection

A construct provided by the underlying transport protocol that is being used by MQTT.

For examples see Section 4.2.

Application Message

The data carried by the MQTT protocol across the network for the application.
When Application Messages are transported by MQTT they have an associated Quality of Service and a Topic Name.

Client

A program or device that uses MQTT. A Client always establishes the Network Connection to the Server. It can

  1. Publish Application Messages that other Clients might be interested in.
  2. Subscribe to request Application Messages that it is interested in receiving.
  3. Unsubscribe to remove a request for Application Messages.
  4. Disconnect from the Server.

Server

A program or device that acts as an intermediary between

A Server

  1. Accepts Network Connections from Clients.
  2. Accepts Application Messages published by Clients.
  3. Processes Subscribe and Unsubscribe requests from Clients.
  4. Forwards Application Messages that match Client Subscriptions.

Subscription

  1. comprises a Topic Filter and a maximum QoS.
  2. is associated with a single Session.
  3. 1 or more in a Session.
  4. Each has a different Topic Filter in a session.

Topic Name

The label attached to an Application Message which is matched against the Subscriptions known to the Server.

The Server sends a copy of the Application Message to each Client that has a matching Subscription.

Topic Filter

An expression contained in a Subscription, to indicate an interest in one or more topics. A Topic Filter can include wildcard characters.

Session

A stateful interaction between a Client and a Server.

Some Sessions last only as long as the Network Connection, others can span multiple consecutive Network Connections between a Client and a Server.

MQTT Control Packet

A packet of information that is sent across the Network Connection.

The MQTT specification defines 14 different types of Control Packet, one of which (the PUBLISH packet) is used to convey Application Messages.

1.5.2 Integer data values

Integer data values are 16 bits in big-endian order: the high order byte precedes the lower order byte. This means that a 16-bit word is presented on the network as Most Significant Byte (MSB), followed by Least Significant Byte (LSB).

3.1 CONNECT – Client requests a connection to a Server

After a Network Connection is established by a Client to a Server, the first Packet sent from the Client to the Server MUST be a CONNECT Packet.

TCP Transfer Control Protocol.

 

 

message broker (aka integration broker or interface engine) wp

a sw-program that translates a message

MQQT server

  1. Mosquitto: Eclipse MQTT server.
  2. www.hivemq.com/hivemq/mqtt-broker/

wp/Zigbee

mqtt.org/

mqtt.org/faq/

www.steves-internet-guide.com/mqtt-works/

www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt/

 

Comunicazione mediata da un gestore di messaggi

Il concetto generale

Message middleware, Message-oriented middleware

SW che permette una piu' facile comunicazione tra senders and receivers

quindi senders e receivers non comunicano direttamente,
bensi' comunicano col SW di intermediazione.

Tale SW e' reso disponibile nel cloud come "software as a service", tutti devono iscriversi, eventualmente pagare, il servizio.

Come architettura SW esistono 2 sistemi elementari

rob: lo stesso breve nome viene usato per i 2 aspetti: sw-pattern, sw-service, cioe' per l'aspetto di tecnica sw e l'aspetto commerciale; puo' confondere i principianti.

I SW reali (anno 2022) sono spesso piu' articolati.

Vantaggi/svantaggi rispetto alla comunicazione diretta

Vantaggl: greater network scalability; more dynamic network topology

Svantaggi: decreased flexibilitfy to modify the publisher and the structure of the published data.

 

publish–subscribe pattern