Skip to content

Commit

Permalink
!per #3785 Change default implementation of processorId
Browse files Browse the repository at this point in the history
- also affects channel ids.
  • Loading branch information
krasserm committed Dec 12, 2013
1 parent 8b6b296 commit f55c711
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
20 changes: 8 additions & 12 deletions akka-docs/rst/java/persistence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,17 @@ Identifiers
-----------

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

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
actor references because their paths also contain deployment information such as host and port (and actor deployments
are likely to change during the lifetime of an application). In this case, ``UntypedProcessor`` implementation classes
should override ``processorId``.
section :ref:`processors-java`. This changes that processor's name in its actor hierarchy and hence influences only
part of the processor id. To fully customize a processor's id, the ``processorId`` method should be overridden.

.. 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
Expand Down Expand Up @@ -299,11 +296,10 @@ Default is ``Resolve.off()`` which means no resolution. Find out more in the ``D
Identifiers
-----------

In the same way as :ref:`processors-java`, 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
works well when using local actor references but may cause problems with remote actor references. In this case, an
application-defined channel id should be provided as argument to ``Channel.props(String)`` or
``PersistentChannel.props(String)``.
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. This changes that channel's
name in its actor hierarchy and hence influences only part of the channel identifier. To fully customize a channel
identifier, it should be provided as argument ``Channel.props(String)`` or ``PersistentChannel.props(String)``.

.. includecode:: code/docs/persistence/PersistenceDocTest.java#channel-id-override

Expand Down
18 changes: 7 additions & 11 deletions akka-docs/rst/scala/persistence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,17 @@ Identifiers
-----------

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

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
actor references because their paths also contain deployment information such as host and port (and actor deployments
are likely to change during the lifetime of an application). In this case, ``Processor`` implementation classes
should override ``processorId``.
section :ref:`processors`. This changes that processor's name in its actor hierarchy and hence influences only
part of the processor id. To fully customize a processor's id, the ``processorId`` method should be overridden.

.. 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
Expand Down Expand Up @@ -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
identifier can therefore be customized by using a custom actor name at channel creation. As already mentioned, this
works well when using local actor references but may cause problems with remote actor references. In this case, an
application-defined channel id should be provided as argument to ``Channel.props(String)`` or
``PersistentChannel.props(String)``.
identifier can therefore be customized by using a custom actor name at channel creation. This changes that channel's
name in its actor hierarchy and hence influences only part of the channel identifier. To fully customize a channel
identifier, it should be provided as argument ``Channel.props(String)`` or ``PersistentChannel.props(String)``.

.. includecode:: code/docs/persistence/PersistenceDocSpec.scala#channel-id-override

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ class Persistence(val system: ExtendedActorSystem) extends Extension {
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("/", "/", "")
}

0 comments on commit f55c711

Please sign in to comment.