Search Results for

    Show / Hide Table of Contents

    Akka.Persistence Configuration

    Below is the default HOCON configuration for the base Akka.Persistence package.

    ###########################################################
    # Akka Persistence Extension Reference Configuration File #
    ###########################################################
    
    # This is the reference config file that contains all the default settings.
    # Make your edits in your application.conf in order to override these settings.
    
    # Directory of persistence journal and snapshot store plugins is available at the
    # Akka.NET Community Projects page http://getakka.net/docs/Community%20Plugins
    
    # Default persistence extension settings.
    akka.persistence {
        # When starting many persistent actors at the same time the journal
        # and its data store is protected from being overloaded by limiting number
        # of recoveries that can be in progress at the same time. When
        # exceeding the limit the actors will wait until other recoveries have
        # been completed.   
        max-concurrent-recoveries = 50
    
        # Fully qualified class name providing a default internal stash overflow strategy.
        # It needs to be a subclass of Akka.Persistence.StashOverflowStrategyConfigurator
        # The default strategy throws StashOverflowException
        internal-stash-overflow-strategy = "Akka.Persistence.ThrowExceptionConfigurator, Akka.Persistence"
        journal {
            # Absolute path to the journal plugin configuration entry used by
            # persistent actor or view by default.
            # Persistent actor or view can override `journalPluginId` method
            # in order to rely on a different journal plugin.
            plugin = "akka.persistence.journal.inmem"
            # List of journal plugins to start automatically. Use "" for the default journal plugin.
            auto-start-journals = []
        }
        snapshot-store {
            # Absolute path to the snapshot plugin configuration entry used by
            # persistent actor or view by default.
            # Persistent actor or view can override `snapshotPluginId` method
            # in order to rely on a different snapshot plugin.
            # It is not mandatory to specify a snapshot store plugin.
            # If you don't use snapshots you don't have to configure it.
            # Note that Cluster Sharding is using snapshots, so if you
            # use Cluster Sharding you need to define a snapshot store plugin.
            plugin = "akka.persistence.snapshot-store.local"
            # List of snapshot stores to start automatically. Use "" for the default snapshot store.
            auto-start-snapshot-stores = []
        }
        # used as default-snapshot store if no plugin configured
        # (see `akka.persistence.snapshot-store`)
        no-snapshot-store {
            class = "Akka.Persistence.Snapshot.NoSnapshotStore, Akka.Persistence"
        }
        # Default persistent view settings.
        view {
            # Automated incremental view update.
            auto-update = on
            # Interval between incremental updates.
            auto-update-interval = 5s
            # Maximum number of messages to replay per incremental view update.
            # Set to -1 for no upper limit.
            auto-update-replay-max = -1
        }
        # Default reliable delivery settings.
        at-least-once-delivery {
            # Interval between re-delivery attempts.
            redeliver-interval = 5s
            # Maximum number of unconfirmed messages that will be sent in one
            # re-delivery burst.
            redelivery-burst-limit = 10000
            # After this number of delivery attempts a
            # `ReliableRedelivery.UnconfirmedWarning`, message will be sent to the actor.
            warn-after-number-of-unconfirmed-attempts = 5
            # Maximum number of unconfirmed messages that an actor with
            # AtLeastOnceDelivery is allowed to hold in memory.
            max-unconfirmed-messages = 100000
        }
        # Default persistent extension thread pools.
        dispatchers {
            # Dispatcher used by every plugin which does not declare explicit
            # `plugin-dispatcher` field.
            default-plugin-dispatcher {
                type = Dispatcher
                executor = "default-executor"
            }
            # Default dispatcher for message replay.
            default-replay-dispatcher {
                type = Dispatcher
                executor = "default-executor"
                dedicated-thread-pool {
                    # Fixed number of threads to have in this threadpool
                    thread-count = 8
                }
            }
            # Default dispatcher for streaming snapshot IO
            default-stream-dispatcher {
                type = Dispatcher
                dedicated-thread-pool {
                    # Fixed number of threads to have in this threadpool
                    thread-count = 8
                }
            }
        }
    
        # Fallback settings for journal plugin configurations.
        # These settings are used if they are not defined in plugin config section.
        journal-plugin-fallback {
    
            # Fully qualified class name providing journal plugin api implementation.
            # It is mandatory to specify this property.
            # The class must have a constructor without parameters or constructor with
            # one `Akka.Configuration.Config` parameter.
            class = ""
    
            # Dispatcher for the plugin actor.
            plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
    
            # Dispatcher for message replay.
            replay-dispatcher = "akka.persistence.dispatchers.default-replay-dispatcher"
            # journal supervisor strategy used. 
            # It needs to be a subclass of Akka.Actor.SupervisorStrategyConfigurator. And have a parameterless constructor
            # by default it restarts the journal on crash
            supervisor-strategy = "Akka.Actor.DefaultSupervisorStrategy"
            
            # Default serializer used as manifest serializer when applicable and payload serializer when no specific binding overrides are specified
            serializer = "json"
            
            # Removed: used to be the Maximum size of a persistent message batch written to the journal.
            # Now this setting is without function, PersistentActor will write as many messages
            # as it has accumulated since the last write.
            max-message-batch-size = 200
    
            # If there is more time in between individual events gotten from the Journal
            # recovery than this the recovery will fail.
            # Note that it also affect reading the snapshot before replaying events on
            # top of it, even though iti is configured for the journal.
            recovery-event-timeout = 30s
    
            circuit-breaker {
                max-failures = 10
                call-timeout = 10s
                reset-timeout = 30s
            }
    
            # The replay filter can detect a corrupt event stream by inspecting
            # sequence numbers and writerUuid when replaying events.
            replay-filter {
                # What the filter should do when detecting invalid events.
                # Supported values:
                # `repair-by-discard-old` : discard events from old writers,
                #                           warning is logged
                # `fail` : fail the replay, error is logged
                # `warn` : log warning but emit events untouche
                # `off` : disable this feature completely
                mode = repair-by-discard-old
    
                # It uses a look ahead buffer for analyzing the events.
                # This defines the size (in number of events) of the buffer.
                window-size = 100
    
                # How many old writerUuid to remember
                max-old-writers = 10
    
                # Set this to `on` to enable detailed debug logging of each
                # replayed event.
                debug = off
            }
        }
    
        # Fallback settings for snapshot store plugin configurations
        # These settings are used if they are not defined in plugin config section.
        snapshot-store-plugin-fallback {
    
            # Fully qualified class name providing snapshot store plugin api
            # implementation. It is mandatory to specify this property if
            # snapshot store is enabled.
            # The class must have a constructor without parameters or constructor with
            # one `Akka.Configuration.Config` parameter.
            class = ""
    
            # Dispatcher for the plugin actor.
            plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
            
            # snapshot supervisor strategy used.
            # It needs to be a subclass of Akka.Actor.SupervisorStrategyConfigurator. And have a parameterless constructor
            # by default it restarts the snapshot on crash
            supervisor-strategy = "Akka.Actor.DefaultSupervisorStrategy"
            
            # Default serializer used as manifest serializer when applicable and payload serializer when no specific binding overrides are specified
            serializer = "json"
            circuit-breaker {
                max-failures = 5
                call-timeout = 20s
                reset-timeout = 60s
            }
            
            # Set this to true if successful loading of snapshot is not necessary.
            # This can be useful when it is alright to ignore snapshot in case of
            # for example deserialization errors. When snapshot loading fails it will instead
            # recover by replaying all events.
            # Don't set to true if events are deleted because that would
            # result in wrong recovered state if snapshot load fails.
            snapshot-is-optional = false
        }
    
        fsm {
            # PersistentFSM saves snapshots after this number of persistent
            # events. Snapshots are used to reduce recovery times.
            # When you disable this feature, specify snapshot-after = off.
            # To enable the feature, specify a number like snapshot-after = 1000
            # which means a snapshot is taken after persisting every 1000 events.
            snapshot-after = off
        }
    }
    
    ###################################################
    # Persistence plugins included with the extension #
    ###################################################
    
    # In-memory journal plugin.
    akka.persistence.journal.inmem {
        # Class name of the plugin.
        class = "Akka.Persistence.Journal.MemoryJournal, Akka.Persistence"
        # Dispatcher for the plugin actor.
        plugin-dispatcher = "akka.actor.default-dispatcher"
    }
    
    # In-memory snapshot store plugin.
    akka.persistence.snapshot-store.inmem {
        # Class name of the plugin.
        class = "Akka.Persistence.Snapshot.MemorySnapshotStore, Akka.Persistence"
        # Dispatcher for the plugin actor.
        plugin-dispatcher = "akka.actor.default-dispatcher"
    }
    
    # Local file system snapshot store plugin.
    akka.persistence.snapshot-store.local {
        # Class name of the plugin.
        class = "Akka.Persistence.Snapshot.LocalSnapshotStore, Akka.Persistence"
        # Dispatcher for the plugin actor.
        plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
        # Dispatcher for streaming snapshot IO.
        stream-dispatcher = "akka.persistence.dispatchers.default-stream-dispatcher"
        # Storage location of snapshot files.
        dir = "snapshots"
        # Number load attempts when recovering from the latest snapshot fails
        # yet older snapshot files are available. Each recovery attempt will try
        # to recover using an older than previously failed-on snapshot file
        # (if any are present). If all attempts fail the recovery will fail and
        # the persistent actor will be stopped.
        max-load-attempts = 3
    }
    
    akka.persistence.journal.proxy {
        # Class name of the plugin.
        class = "Akka.Persistence.Journal.PersistencePluginProxy, Akka.Persistence"
        # Dispatcher for the plugin actor.
        plugin-dispatcher = "akka.actor.default-dispatcher"
        # Set this to on in the configuration of the ActorSystem
        # that will host the target journal
        start-target-journal = off
        # The journal plugin config path to use for the target journal
        target-journal-plugin = ""
        # The address of the proxy to connect to from other nodes. Optional setting.
        target-journal-address = ""
        # Initialization timeout of target lookup
        init-timeout = 10s
    }
    
    akka.persistence.snapshot-store.proxy {
        # Class name of the plugin.
        class = "Akka.Persistence.Journal.PersistencePluginProxy, Akka.Persistence"
        # Dispatcher for the plugin actor.
        plugin-dispatcher = "akka.actor.default-dispatcher"
        # Set this to on in the configuration of the ActorSystem
        # that will host the target snapshot-store
        start-target-snapshot-store = off
        # The journal plugin config path to use for the target snapshot-store
        target-snapshot-store-plugin = ""
        # The address of the proxy to connect to from other nodes. Optional setting.
        target-snapshot-store-address = ""
        # Initialization timeout of target lookup
        init-timeout = 10s
    }
    
    # Protobuf serialization for the persistent extension messages.
    akka.actor {
        serializers {
            akka-persistence-message = "Akka.Persistence.Serialization.PersistenceMessageSerializer, Akka.Persistence"
            akka-persistence-snapshot = "Akka.Persistence.Serialization.PersistenceSnapshotSerializer, Akka.Persistence"
        }
        serialization-bindings {
            "Akka.Persistence.Serialization.IMessage, Akka.Persistence" = akka-persistence-message
            "Akka.Persistence.Serialization.Snapshot, Akka.Persistence" = akka-persistence-snapshot
        }
        serialization-identifiers {
            "Akka.Persistence.Serialization.PersistenceMessageSerializer, Akka.Persistence" = 7
            "Akka.Persistence.Serialization.PersistenceSnapshotSerializer, Akka.Persistence" = 8
        }
    }
    
    akka.reliable-delivery {
      producer-controller {
        event-sourced-durable-queue {
          # Max duration for the exponential backoff for persist failures.
          restart-max-backoff = 10s
    
          # Snapshot after this number of events. See RetentionCriteria.
          snapshot-every = 1000
    
          # Number of snapshots to keep. See RetentionCriteria.
          keep-n-snapshots = 2
    
          # Delete events after snapshotting. See RetentionCriteria.
          delete-events = on
    
          # Cleanup entries that haven't be used for this duration.
          cleanup-unused-after = 3600s
    
          # The journal plugin to use, by default it will use the plugin configured by
          # `akka.persistence.journal.plugin`.
          journal-plugin-id = ""
    
          # The journal plugin to use, by default it will use the plugin configured by
          # `akka.persistence.snapshot-store.plugin`.
          snapshot-plugin-id = ""
        }
      }
    }
    
    In this article
    • githubEdit this page
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET