Overview

ADAPT uses message passing for communication between ADAPT nodes. Messages are requests sent by one node to another node to execute a specific transaction.

For more information about transactions, refer to the packet interface.

The function of the ADAPT message broker is to pass messages between ADAPT nodes on the specific network.

The broker maps each packet ID to an ADAPT node IP address and enables MUFL code to designate addressee nodes by packet IDs. MUFL code sends transaction requests (each containing the packet ID of the destination packet) to the message broker. In turn, the message broker translates the application layer routing (unique packet IDs) to the internet layer routing addresses (IP addresses of the ADAPT nodes) and routes the transaction to the node containing the packet. The MUFL language and your MUFL code are unaware of the actual methods used to transmit messages within the network.

The typical communication process between two ADAPT nodes is:

  1. The node containing packet A sends a registration request to the ADAPT message broker. The request contains the information about packet A running inside the node.
  2. The message broker registers packet A and stores its packet ID and the IP address of the ADAPT node where packet A is running.
  3. The node containing packet B sends a registration request to the message broker.
  4. The message broker registers packet B and stores its packet ID and the IP address of the ADAPT node where packet B is running.
  5. From your code’s perspective, packet A sends a transaction request to destination packet B using packet B’s packet ID.
  6. In actuality, ADAPT routes the transaction request through the message broker.
  7. The message broker redirects the transaction request to the corresponding node’s IP address.
  8. The node receives the transaction request from the broker and directs the transaction to destination packet B.
  9. Packet B processes the transaction request and invokes the requested transaction. The transaction request contains the packet ID of the sender (packet A), enabling the application logic of packet B to know where the request came from.

For a more detailed overview of the process, refer to the ADAPT messaging protocol.

The message broker is not designed to be a secure component. It does not provide additional security. All transaction request messages passed to the message broker are end-to-end encrypted (depending on the application logic, but generally, MUFL provides developers with a simple way to encrypt and sign messages). Thus, even if the message broker is compromised, it does not reveal any sensitive information to an attacker.

The message broker does not currently guarantee delivery of messages. Each packet’s application logic should include timeout requests and ensure idempotency of messages.

The message broker is implemented as a TypeScript module and utilizes the native ADAPT TypeScript add-on, adapt_js.

adapt_js can be found in /mufl/addon/adapt_js/ in the ADAPT Docker development kit and in ./addon/adapt_js in the main Git repository.

The message broker script resides in /mufl/utilities/executables/dist/broker.js in the ADAPT Docker development kit and in ./utilities/executables/src/broker.ts in the main Git repository.