PersistencePluginProxy

* Rename to PersistencePluginProxy.
* Watch target journal.
* Create PersistencePluginProxyExtension to enable eager initialization of
  the persistence plugin.
* Add initialization via configuration.
* Add tests and documentation.
* Clearer log messages.
This commit is contained in:
Tal Pressman 2015-11-17 16:50:54 +02:00
parent d39b368cac
commit f610952ae7
9 changed files with 338 additions and 40 deletions

View file

@ -892,6 +892,10 @@ backup node.
A shared LevelDB instance is a single point of failure and should therefore only be used for testing
purposes. Highly-available, replicated journal are available as `Community plugins`_.
.. note::
This plugin has been supplanted by :ref:`Persistence Plugin Proxy<persistence-plugin-proxy-lambda>`.
A shared LevelDB instance is started by instantiating the ``SharedLeveldbStore`` actor.
.. includecode:: code/docs/persistence/PersistencePluginDocTest.java#shared-store-creation
@ -932,6 +936,43 @@ directory. This can be changed by configuration where the specified path can be
Note that it is not mandatory to specify a snapshot store plugin. If you don't use snapshots
you don't have to configure it.
.. _persistence-plugin-proxy-lambda:
Persistence Plugin Proxy
------------------------
A persistence plugin proxy allows sharing of journals and snapshot stores across multiple actor systems (on the same or
on different nodes). This, for example, allows persistent actors to failover to a backup node and continue using the
shared journal instance from the backup node. The proxy works by forwarding all the journal/snapshot store messages to a
single, shared, persistence plugin instance, and therefor supports any use case supported by the proxied plugin.
.. warning::
A shared journal/snapshot store is a single point of failure and should therefore only be used for testing
purposes. Highly-available, replicated persistence plugins are available as `Community plugins`_.
The journal and snapshot store proxies are controlled via the ``akka.persistence.journal.proxy`` and
``akka.persistence.snapshot-store.proxy`` configuration entries, respectively. Set the ``target-journal-plugin`` or
``target-snapshot-store-plugin`` keys to the underlying plugin you wish to use (for example:
``akka.persistence.journal.leveldb``). The ``start-target-journal`` and ``start-target-snapshot-store`` keys should be
set to ``on`` in exactly one actor system - this is the system that will instantiate the shared persistence plugin.
Next, the proxy needs to be told how to find the shared plugin. This can be done by setting the ``target-journal-address``
and ``target-snapshot-store-address`` configuration keys, or programmatically by calling the
``PersistencePluginProxy.setTargetLocation`` method.
.. note::
Akka starts extensions lazily when they are required, and this includes the proxy. This means that in order for the
proxy to work, the persistence plugin on the target node must be instantiated. This can be done by instantiating the
``PersistencePluginProxyExtension`` :ref:`extension<extending-akka-java>`, or by calling the ``PersistencePluginProxy.start`` method.
.. note::
The proxied persistence plugin can (and should) be configured using its original configuration keys.
.. _custom-serialization-lambda:
Custom serialization
====================

View file

@ -882,6 +882,10 @@ backup node.
A shared LevelDB instance is a single point of failure and should therefore only be used for testing
purposes. Highly-available, replicated journal are available as `Community plugins`_.
.. note::
This plugin has been supplanted by :ref:`Persistence Plugin Proxy<persistence-plugin-proxy-java>`.
A shared LevelDB instance is started by instantiating the ``SharedLeveldbStore`` actor.
.. includecode:: code/docs/persistence/PersistencePluginDocTest.java#shared-store-creation
@ -922,6 +926,43 @@ directory. This can be changed by configuration where the specified path can be
Note that it is not mandatory to specify a snapshot store plugin. If you don't use snapshots
you don't have to configure it.
.. _persistence-plugin-proxy-java:
Persistence Plugin Proxy
------------------------
A persistence plugin proxy allows sharing of journals and snapshot stores across multiple actor systems (on the same or
on different nodes). This, for example, allows persistent actors to failover to a backup node and continue using the
shared journal instance from the backup node. The proxy works by forwarding all the journal/snapshot store messages to a
single, shared, persistence plugin instance, and therefor supports any use case supported by the proxied plugin.
.. warning::
A shared journal/snapshot store is a single point of failure and should therefore only be used for testing
purposes. Highly-available, replicated persistence plugins are available as `Community plugins`_.
The journal and snapshot store proxies are controlled via the ``akka.persistence.journal.proxy`` and
``akka.persistence.snapshot-store.proxy`` configuration entries, respectively. Set the ``target-journal-plugin`` or
``target-snapshot-store-plugin`` keys to the underlying plugin you wish to use (for example:
``akka.persistence.journal.leveldb``). The ``start-target-journal`` and ``start-target-snapshot-store`` keys should be
set to ``on`` in exactly one actor system - this is the system that will instantiate the shared persistence plugin.
Next, the proxy needs to be told how to find the shared plugin. This can be done by setting the ``target-journal-address``
and ``target-snapshot-store-address`` configuration keys, or programmatically by calling the
``PersistencePluginProxy.setTargetLocation`` method.
.. note::
Akka starts extensions lazily when they are required, and this includes the proxy. This means that in order for the
proxy to work, the persistence plugin on the target node must be instantiated. This can be done by instantiating the
``PersistencePluginProxyExtension`` :ref:`extension<extending-akka-java>`, or by calling the ``PersistencePluginProxy.start`` method.
.. note::
The proxied persistence plugin can (and should) be configured using its original configuration keys.
.. _custom-serialization-java:
Custom serialization
====================