InMemoryPersistencehas been renamed and moved to a dedicated package called the
Some scenarios require an non-durable persistence such as the development environment or a lightweight client not interested in durability across restarts:
For a description of each feature, see the persistence at a glance legend.
|Storage Types||Sagas, Outbox, Subscriptions|
|Concurrency control||Optimistic concurrency|
|Scripted deployment||Does not apply|
|Installers||Does not apply|
var persistence = busConfiguration.UsePersistence<InMemoryPersistence>(); persistence.For( Storage.Sagas, Storage.Subscriptions, Storage.Timeouts, Storage.Outbox, Storage.GatewayDeduplication);
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Sagas>(); busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>(); busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>(); busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Outbox>(); busConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
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.
In-memory gateway deduplication persistence has no built-in cleanup.
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.
System.InvalidOperationException: The saga with the correlation id 'Name: OrderId Value: f05c6e0c-aea6-48d6-846c-d1663998ebf2' already exists
Non-durable persistence uses optimistic concurrency control when updating or deleting saga data.
System.Exception: InMemorySagaPersister concurrency violation: saga entity Id[a15a31fd-4f25-4dc3-b556-aad200e52dcb] already saved.