Add more explicit docs of top level coexistence (#29921)
This commit is contained in:
parent
aa03e8b089
commit
b989c4cf3e
2 changed files with 15 additions and 3 deletions
|
|
@ -88,7 +88,17 @@ Java
|
||||||
|
|
||||||
@scala[That adds some implicit extension methods that are added to classic and typed `ActorSystem`, `ActorContext` and `ActorRef` in both directions.]
|
@scala[That adds some implicit extension methods that are added to classic and typed `ActorSystem`, `ActorContext` and `ActorRef` in both directions.]
|
||||||
@java[To convert between typed and classic `ActorSystem`, `ActorContext` and `ActorRef` in both directions there are adapter methods in `akka.actor.typed.javadsl.Adapter`.]
|
@java[To convert between typed and classic `ActorSystem`, `ActorContext` and `ActorRef` in both directions there are adapter methods in `akka.actor.typed.javadsl.Adapter`.]
|
||||||
Note the inline comments in the example above.
|
Note the inline comments in the example above.
|
||||||
|
|
||||||
|
This method of using a top level classic actor is the suggested path for this type of co-existence. However, if you prefer to start with a typed top level actor then you can use the @scala[implicit `spawn` -method]@java[`Adapter.spawn`] directly from the typed system:
|
||||||
|
|
||||||
|
Scala
|
||||||
|
: @@snip [TypedWatchingClassicSpec.scala](/akka-actor-typed-tests/src/test/scala/docs/akka/typed/coexistence/TypedWatchingClassicSpec.scala) { #create }
|
||||||
|
|
||||||
|
Java
|
||||||
|
: @@snip [TypedWatchingClassicTest.java](/akka-actor-typed-tests/src/test/java/jdocs/akka/typed/coexistence/TypedWatchingClassicTest.java) { #create }
|
||||||
|
|
||||||
|
The above classic-typed difference is further elaborated in @ref:[the `ActorSystem` section](./from-classic.md#actorsystem) of "Learning Akka Typed from Classic".
|
||||||
|
|
||||||
## Typed to classic
|
## Typed to classic
|
||||||
|
|
||||||
|
|
@ -145,4 +155,3 @@ the child, for example if a classic actor creates a typed child, its default sup
|
||||||
actor creates a classic child, its default supervision will be to restart.
|
actor creates a classic child, its default supervision will be to restart.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,10 @@ typically performed from the "outside".
|
||||||
|
|
||||||
The `actorOf` method of the classic `ActorSystem` is typically used to create a few (or many) top level actors. The
|
The `actorOf` method of the classic `ActorSystem` is typically used to create a few (or many) top level actors. The
|
||||||
`ActorSystem` in Typed doesn't have that capability. Instead, such actors are started as children of
|
`ActorSystem` in Typed doesn't have that capability. Instead, such actors are started as children of
|
||||||
the user guardian actor or children of other actors in the actor hierarchy.
|
the user guardian actor or children of other actors in the actor hierarchy. The rationale for this is partly about consistency.
|
||||||
|
In a typed system you can’t create children to an arbitrary actor from anywhere in your app without messaging it,
|
||||||
|
so this will also hold true for the user guardian actor. That noted, in cases where you do need to spawn outside of this guardian
|
||||||
|
then you can use the @ref:[`SpawnProtocol`](./actor-lifecycle.md#spawnprotocol) to spawn as needed.
|
||||||
|
|
||||||
## become
|
## become
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue