From v8, the InMemoryPersistence
has been renamed and moved to a dedicated package called the NonDurablePersistence
Some scenarios require a non-durable persistence such as the development environment or a lightweight client not interested in durability across restarts:
Persistence at a glance
For a description of each feature, see the persistence at a glance legend.
Feature | |
---|---|
Storage Types | Sagas, Outbox, Subscriptions |
Transactions | None |
Concurrency control | Optimistic concurrency |
Scripted deployment | Does not apply |
Installers | Does not apply |
Configuration
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Sagas>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Outbox>();
All information stored is discarded when the process ends.
The delayed retries mechanism uses the timeout manager when a transport does not natively support delayed delivery. As delayed retries are enabled by default, using this persistence with a transport that uses the timeout manager has the risk of losing messages that have failed processing and are waiting for another retry attempt. Use this persistence only in scenarios where it is acceptable to lose messages.
Gateway deduplication
It is advised to use the in-memory persister that is part of the gateway package.
In-memory gateway deduplication persistence has no built-in cleanup.
Saga concurrency
When simultaneously handling messages, conflicts may occur. See below for examples of the exceptions which are thrown. Saga concurrency explains how these conflicts are handled, and contains guidance for high-load scenarios.
Starting a saga
Example exception:
System.InvalidOperationException: The saga with the correlation id 'Name: OrderId Value: f05c6e0c-aea6-48d6-846c-d1663998ebf2' already exists
Updating or deleting saga data
Non-durable persistence uses optimistic concurrency control when updating or deleting saga data.
Example exception: