ZeroMQ module's ConcurrentSocketActorSpec fails.
* Fixed usage of extension. See #1746 * Clarified usage of load extensions in docs. See #1745
This commit is contained in:
parent
945ab2c6ab
commit
269ff0aa96
4 changed files with 29 additions and 7 deletions
|
|
@ -54,6 +54,12 @@ Loading from Configuration
|
||||||
To be able to load extensions from your Akka configuration you must add FQCNs of implementations of either ``ExtensionId`` or ``ExtensionIdProvider``
|
To be able to load extensions from your Akka configuration you must add FQCNs of implementations of either ``ExtensionId`` or ``ExtensionIdProvider``
|
||||||
in the "akka.extensions" section of the config you provide to your ``ActorSystem``.
|
in the "akka.extensions" section of the config you provide to your ``ActorSystem``.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
akka {
|
||||||
|
extensions = ["akka.docs.extension.ExtensionDocTestBase.CountExtension"]
|
||||||
|
}
|
||||||
|
|
||||||
Applicability
|
Applicability
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,15 @@ object CountExtension
|
||||||
//#extensionid
|
//#extensionid
|
||||||
|
|
||||||
object ExtensionDocSpec {
|
object ExtensionDocSpec {
|
||||||
|
|
||||||
|
val config = """
|
||||||
|
//#config
|
||||||
|
akka {
|
||||||
|
extensions = ["akka.docs.extension.CountExtension$"]
|
||||||
|
}
|
||||||
|
//#config
|
||||||
|
"""
|
||||||
|
|
||||||
//#extension-usage-actor
|
//#extension-usage-actor
|
||||||
|
|
||||||
class MyActor extends Actor {
|
class MyActor extends Actor {
|
||||||
|
|
@ -64,7 +73,7 @@ object ExtensionDocSpec {
|
||||||
//#extension-usage-actor-trait
|
//#extension-usage-actor-trait
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExtensionDocSpec extends AkkaSpec {
|
class ExtensionDocSpec extends AkkaSpec(ExtensionDocSpec.config) {
|
||||||
import ExtensionDocSpec._
|
import ExtensionDocSpec._
|
||||||
|
|
||||||
"demonstrate how to create an extension in Scala" in {
|
"demonstrate how to create an extension in Scala" in {
|
||||||
|
|
@ -73,4 +82,10 @@ class ExtensionDocSpec extends AkkaSpec {
|
||||||
//#extension-usage
|
//#extension-usage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"demonstrate how to lookup a configured extension in Scala" in {
|
||||||
|
//#extension-lookup
|
||||||
|
system.extension(CountExtension)
|
||||||
|
//#extension-lookup
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,11 @@ Loading from Configuration
|
||||||
To be able to load extensions from your Akka configuration you must add FQCNs of implementations of either ``ExtensionId`` or ``ExtensionIdProvider``
|
To be able to load extensions from your Akka configuration you must add FQCNs of implementations of either ``ExtensionId`` or ``ExtensionIdProvider``
|
||||||
in the ``akka.extensions`` section of the config you provide to your ``ActorSystem``.
|
in the ``akka.extensions`` section of the config you provide to your ``ActorSystem``.
|
||||||
|
|
||||||
|
.. includecode:: code/akka/docs/extension/ExtensionDocSpec.scala
|
||||||
|
:include: config
|
||||||
|
|
||||||
|
Note that in this case ``CountExtension`` is an object and therefore the class name ends with ``$``.
|
||||||
|
|
||||||
Applicability
|
Applicability
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,7 @@ import akka.util.duration._
|
||||||
import akka.actor.{ Cancellable, Actor, Props, ActorRef }
|
import akka.actor.{ Cancellable, Actor, Props, ActorRef }
|
||||||
|
|
||||||
object ConcurrentSocketActorSpec {
|
object ConcurrentSocketActorSpec {
|
||||||
val config = """
|
val config = ""
|
||||||
akka {
|
|
||||||
extensions = ["akka.zeromq.ZeroMQExtension"]
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConcurrentSocketActorSpec
|
class ConcurrentSocketActorSpec
|
||||||
|
|
@ -23,7 +19,7 @@ class ConcurrentSocketActorSpec
|
||||||
|
|
||||||
val endpoint = "tcp://127.0.0.1:%s" format { val s = new java.net.ServerSocket(0); try s.getLocalPort finally s.close() }
|
val endpoint = "tcp://127.0.0.1:%s" format { val s = new java.net.ServerSocket(0); try s.getLocalPort finally s.close() }
|
||||||
|
|
||||||
def zmq = system.extension(ZeroMQExtension)
|
def zmq = ZeroMQExtension(system)
|
||||||
|
|
||||||
"ConcurrentSocketActor" should {
|
"ConcurrentSocketActor" should {
|
||||||
"support pub-sub connections" in {
|
"support pub-sub connections" in {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue