# Message Publishing and Delivery

DPSN facilitates the efficient and reliable publishing and delivery of messages across its decentralized network. This section outlines the core functionalities and underlying mechanisms involved in this process.

#### Message Publishing

* **Message Creation:** Publishers generate messages containing relevant data and metadata. Messages can be structured in various formats (e.g., JSON, XML) to accommodate different data types.
* **Topic Selection:** Publishers choose the appropriate topic to which the message belongs. This ensures accurate message routing and delivery to interested subscribers.
* **Message Signing:** Publishers sign messages with their private keys to authenticate their identity and ensure message integrity.
* **Message Submission:** Signed messages are submitted to the Configurator, which routes them to the designated clusters.

#### Message Delivery

* **Message Routing:** The Configurator determines the optimal clusters for message delivery based on factors such as topic mapping, network load, and node availability.
* **Message Replication:** Messages are replicated across multiple nodes within the target clusters to enhance reliability and fault tolerance.
* **Message Delivery to Subscribers:** Subscribers subscribed to the relevant topic receive copies of the message from multiple clusters.
* **Message Validation:** Subscribers verify the authenticity and integrity of received messages using the publisher's public key.
* **Message Processing:** Subscribers process the received messages according to their specific applications and requirements.

#### Quality of Service

DPSN supports various quality of service (QoS) levels to meet diverse application needs:

* **At Least Once Delivery:** Guarantees that a message is delivered at least once, but duplicates may occur.
* **At Most Once Delivery:** Delivers a message at most once, but there's a risk of message loss.
* **Exactly Once Delivery:** Ensures that a message is delivered exactly once, providing strong consistency guarantees.

By offering flexible message publishing and delivery mechanisms, DPSN empowers publishers and subscribers to effectively exchange information within the network.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dpsn.org/functionality/message-publishing-and-delivery.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
