Merge pull request #1887 from krasserm/wip-3785-change-default-processor-id-krasserm

!per #3785 Change default implementation of processorId
This commit is contained in:
Patrik Nordwall 2013-12-13 02:02:04 -08:00
commit 4972c7780c
3 changed files with 16 additions and 24 deletions

View file

@ -143,20 +143,17 @@ Identifiers
----------- -----------
A processor must have an identifier that doesn't change across different actor incarnations. It defaults to the A processor must have an identifier that doesn't change across different actor incarnations. It defaults to the
``String`` representation of processor's path and can be obtained via the ``processorId`` method. ``String`` representation of processor's path without the address part and can be obtained via the ``processorId``
method.
.. includecode:: code/docs/persistence/PersistenceDocTest.java#processor-id .. includecode:: code/docs/persistence/PersistenceDocTest.java#processor-id
Applications can customize a processor's id by specifying an actor name during processor creation as shown in Applications can customize a processor's id by specifying an actor name during processor creation as shown in
section :ref:`processors-java`. This works well when using local actor references but may cause problems with remote section :ref:`processors-java`. This changes that processor's name in its actor hierarchy and hence influences only
actor references because their paths also contain deployment information such as host and port (and actor deployments part of the processor id. To fully customize a processor's id, the ``processorId`` method should be overridden.
are likely to change during the lifetime of an application). In this case, ``UntypedProcessor`` implementation classes
should override ``processorId``.
.. includecode:: code/docs/persistence/PersistenceDocTest.java#processor-id-override .. includecode:: code/docs/persistence/PersistenceDocTest.java#processor-id-override
Later versions of Akka persistence will likely offer a possibility to migrate processor ids.
.. _channels-java: .. _channels-java:
Channels Channels
@ -299,11 +296,10 @@ Default is ``Resolve.off()`` which means no resolution. Find out more in the ``D
Identifiers Identifiers
----------- -----------
In the same way as :ref:`processors-java`, channels also have an identifier that defaults to a channel's path. A channel In the same way as :ref:`processors`, channels also have an identifier that defaults to a channel's path. A channel
identifier can therefore be customized by using a custom actor name at channel creation. As already mentioned, this identifier can therefore be customized by using a custom actor name at channel creation. This changes that channel's
works well when using local actor references but may cause problems with remote actor references. In this case, an name in its actor hierarchy and hence influences only part of the channel identifier. To fully customize a channel
application-defined channel id should be provided as argument to ``Channel.props(String)`` or identifier, it should be provided as argument ``Channel.props(String)`` or ``PersistentChannel.props(String)``.
``PersistentChannel.props(String)``.
.. includecode:: code/docs/persistence/PersistenceDocTest.java#channel-id-override .. includecode:: code/docs/persistence/PersistenceDocTest.java#channel-id-override

View file

@ -138,20 +138,17 @@ Identifiers
----------- -----------
A processor must have an identifier that doesn't change across different actor incarnations. It defaults to the A processor must have an identifier that doesn't change across different actor incarnations. It defaults to the
``String`` representation of processor's path and can be obtained via the ``processorId`` method. ``String`` representation of processor's path without the address part and can be obtained via the ``processorId``
method.
.. includecode:: code/docs/persistence/PersistenceDocSpec.scala#processor-id .. includecode:: code/docs/persistence/PersistenceDocSpec.scala#processor-id
Applications can customize a processor's id by specifying an actor name during processor creation as shown in Applications can customize a processor's id by specifying an actor name during processor creation as shown in
section :ref:`processors`. This works well when using local actor references but may cause problems with remote section :ref:`processors`. This changes that processor's name in its actor hierarchy and hence influences only
actor references because their paths also contain deployment information such as host and port (and actor deployments part of the processor id. To fully customize a processor's id, the ``processorId`` method should be overridden.
are likely to change during the lifetime of an application). In this case, ``Processor`` implementation classes
should override ``processorId``.
.. includecode:: code/docs/persistence/PersistenceDocSpec.scala#processor-id-override .. includecode:: code/docs/persistence/PersistenceDocSpec.scala#processor-id-override
Later versions of Akka persistence will likely offer a possibility to migrate processor ids.
.. _channels: .. _channels:
Channels Channels
@ -295,10 +292,9 @@ Identifiers
----------- -----------
In the same way as :ref:`processors`, channels also have an identifier that defaults to a channel's path. A channel In the same way as :ref:`processors`, channels also have an identifier that defaults to a channel's path. A channel
identifier can therefore be customized by using a custom actor name at channel creation. As already mentioned, this identifier can therefore be customized by using a custom actor name at channel creation. This changes that channel's
works well when using local actor references but may cause problems with remote actor references. In this case, an name in its actor hierarchy and hence influences only part of the channel identifier. To fully customize a channel
application-defined channel id should be provided as argument to ``Channel.props(String)`` or identifier, it should be provided as argument ``Channel.props(String)`` or ``PersistentChannel.props(String)``.
``PersistentChannel.props(String)``.
.. includecode:: code/docs/persistence/PersistenceDocSpec.scala#channel-id-override .. includecode:: code/docs/persistence/PersistenceDocSpec.scala#channel-id-override

View file

@ -86,5 +86,5 @@ class Persistence(val system: ExtendedActorSystem) extends Extension {
system.asInstanceOf[ActorSystemImpl].systemActorOf(Props(pluginClass).withDispatcher(pluginDispatcherId), pluginType) system.asInstanceOf[ActorSystemImpl].systemActorOf(Props(pluginClass).withDispatcher(pluginDispatcherId), pluginType)
} }
private def id(ref: ActorRef) = ref.path.toStringWithAddress(system.provider.getDefaultAddress) private def id(ref: ActorRef) = ref.path.elements.mkString("/", "/", "")
} }