> For the complete documentation index, see [llms.txt](https://docs.zongsoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zongsoft.com/documentation/en/framework/messaging/projects/storages.md).

# Message Storage (.storages)

.storages Deployment products of the database message storage project, Broker connection matching and recovery conditions.

\#.storages: message storage

`messaging/.storages` provides a database storage implementation for reliable messages. It saves the record of waiting for delivery and confirmation after being accepted by the Broker; it is not responsible for establishing the network connection of Kafka, RabbitMQ, MQTT or ZeroMQ.

### Project Composition

| composition                        | Purpose                                                             |
| ---------------------------------- | ------------------------------------------------------------------- |
| `Zongsoft.Messaging.Storages.Data` | Message storage plugin supported by data engine                     |
| `database`                         | SQLite, MySQL, PostgreSQL, SQL Server table building resources      |
| Mapping and scripts                | Access messages through named commands of the data engine           |
| storage factory                    | For Broker to create storage by name, explicit assembly is required |

The Redis store is located at [externals/redis](/documentation/en/framework/externals/projects/redis.md) and is not part of the database implementation of this project. Their application integration and recovery rules are summarized in [Reliable Delivery and Message Storage](/documentation/en/framework/messaging/reliability.md).

### Integration Order

1. Select the database and deploy the Data, [Corresponding data-driven](/documentation/en/framework/data/drivers.md) and storage plugins.
2. Use the corresponding table creation resources of the project's database directory in an independent library, and retain the mappings and scripts in the deployment product.
3. Configure a connection with the exact same name as the Broker; the default ZeroMQ guardian Broker is named QueueServer.
4. Set the stable storage identity before starting, and then inject the selected factory into the Broker. LeastOnce is explicitly enabled for both publishing and subscription.
5. Verify acceptance, handle failure, confirmation, restart and expiration messages before using them for business.

{% code title="Application.deploy (append fragment)" %}

```ini
[plugins zongsoft messaging storages]
nuget:Zongsoft.Messaging.Storages.Data
```

{% endcode %}

The above only adds the storage package. The complete solution also requires Data, database driver and Broker. Connection and injection examples are maintained in [Reliable Delivery and Message Storage](/documentation/en/framework/messaging/reliability.md).

### Configuration and Identity

The factory searches for the connection with the same name as the Broker in /Data/ConnectionSettings and /Messaging/Storages/ConnectionSettings in turn, and does not fallback the default business connection. Factory nodes use Sqlite, MySql, PostgreSql, MsSql names, database connection driver keys cannot be used as node names.

Environment variable `ZONGSOFT_MESSAGING_STORAGE_IDENTIFIER` freezes on first use of factory. It and the connection name determine the storage partition; fallback machine name when not set. After the container is rebuilt or the machine is renamed, it is necessary to ensure that the same logical Broker still uses a stable identity.

### Restoration and Maintenance

{% hint style="warning" %}
🚨 Installing the message store does not mean automatically obtaining the transaction outbox, nor does it mean that the message will definitely enter the queue when there is no online matching consumer. Whether to accept, when to re-submit, and how to delete after confirmation are jointly decided by the Broker protocol and the storage implementation.
{% endhint %}

Expired records in the database will be filtered when reading, but will not be automatically cleaned in the background by this plugin. Maintenance should define partitions and check for legacy identity and legacy protocol data compatibility. The business must still design idempotent processing to avoid repeated side effects caused by failures before and after confirmation.

[ZeroMQ project](/documentation/en/framework/messaging/projects/zero.md) · [Message item index](/documentation/en/framework/messaging/projects.md) · [source code and database resources](https://github.com/Zongsoft/framework/tree/main/messaging/.storages)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zongsoft.com/documentation/en/framework/messaging/projects/storages.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
