/Akka.Persistence.NoPersistence

An Akka.net Persistence plugin that provides no persistence whatsoever

Primary LanguageC#GNU Lesser General Public License v3.0LGPL-3.0

Akka.Persistence.NoPersistence

A Akka.net Persistence plugin that provides no persistence whatsoever.

Why is this useful?

If you have a reusable compontent/actor that was designed to be persistent but you want to reuse the given actor in a non-persistent manner. Using the builtin in memory persistence keeps all received messages in memory causing the memory usage of the application to grow over the lifetime of the execution of the application. This persistence plugin implements an AsyncJournal and a SnapshotStore that store and therefor recover nothing and always succeed at doing that 😉.

Usage

  1. Add the package reference:
    dotnet add package Akka.Persistence.NoPersistence 
  2. Configure your application as described here:
     akka.persistence {
         journal {
             plugin = "akka.persistence.journal.none"
             # No persistence journal plugin.
             none {
                 # Class name of the plugin.
                 class = "Akka.Persistence.NoPersistence.EmptyJournal, Akka.Persistence.NoPersistence"
                 # Dispatcher for the plugin actor.
                 plugin-dispatcher = "akka.actor.default-dispatcher"
             }
         }
         snapshot-store {
             plugin = "akka.persistence.snapshot-store.none"
             # No persistence snapshot-store plugin.
             none {
                 # Class name of the plugin.
                 class = "Akka.Persistence.NoPersistence.EmptySnapshotStore, Akka.Persistence.NoPersistence"
                 # Dispatcher for the plugin actor.
                 plugin-dispatcher = "akka.actor.default-dispatcher"
             }
         }

License

This work is licensed under the LGPL license, refer to the COPYING.md and COPYING.LESSER.md files for details.