Making everything compile and tests pass
This commit is contained in:
parent
9ac9e88c31
commit
1a7f29aaec
35 changed files with 101 additions and 59 deletions
|
|
@ -157,7 +157,7 @@ object ActorModelSpec {
|
||||||
try {
|
try {
|
||||||
await(deadline)(stops == dispatcher.stops.get)
|
await(deadline)(stops == dispatcher.stops.get)
|
||||||
} catch {
|
} catch {
|
||||||
case e ⇒
|
case e: Throwable ⇒
|
||||||
system.eventStream.publish(Error(e, dispatcher.toString, dispatcher.getClass, "actual: stops=" + dispatcher.stops.get +
|
system.eventStream.publish(Error(e, dispatcher.toString, dispatcher.getClass, "actual: stops=" + dispatcher.stops.get +
|
||||||
" required: stops=" + stops))
|
" required: stops=" + stops))
|
||||||
throw e
|
throw e
|
||||||
|
|
@ -214,7 +214,7 @@ object ActorModelSpec {
|
||||||
await(deadline)(stats.msgsProcessed.get() == msgsProcessed)
|
await(deadline)(stats.msgsProcessed.get() == msgsProcessed)
|
||||||
await(deadline)(stats.restarts.get() == restarts)
|
await(deadline)(stats.restarts.get() == restarts)
|
||||||
} catch {
|
} catch {
|
||||||
case e ⇒
|
case e: Throwable ⇒
|
||||||
system.eventStream.publish(Error(e,
|
system.eventStream.publish(Error(e,
|
||||||
Option(dispatcher).toString,
|
Option(dispatcher).toString,
|
||||||
(Option(dispatcher) getOrElse this).getClass,
|
(Option(dispatcher) getOrElse this).getClass,
|
||||||
|
|
|
||||||
|
|
@ -646,7 +646,7 @@ private[akka] class ActorSystemImpl(val name: String, applicationConfig: Config,
|
||||||
instance //Profit!
|
instance //Profit!
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
case t ⇒
|
case t: Throwable ⇒
|
||||||
extensions.remove(ext, inProcessOfRegistration) //In case shit hits the fan, remove the inProcess signal
|
extensions.remove(ext, inProcessOfRegistration) //In case shit hits the fan, remove the inProcess signal
|
||||||
throw t //Escalate to caller
|
throw t //Escalate to caller
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ abstract class MessageDispatcher(val prerequisites: DispatcherPrerequisites) ext
|
||||||
try {
|
try {
|
||||||
executeTask(invocation)
|
executeTask(invocation)
|
||||||
} catch {
|
} catch {
|
||||||
case t ⇒
|
case t: Throwable ⇒
|
||||||
addInhabitants(-1)
|
addInhabitants(-1)
|
||||||
throw t
|
throw t
|
||||||
}
|
}
|
||||||
|
|
@ -575,7 +575,7 @@ object ForkJoinExecutorConfigurator {
|
||||||
final override def setRawResult(u: Unit): Unit = ()
|
final override def setRawResult(u: Unit): Unit = ()
|
||||||
final override def getRawResult(): Unit = ()
|
final override def getRawResult(): Unit = ()
|
||||||
final override def exec(): Boolean = try { mailbox.run; true } catch {
|
final override def exec(): Boolean = try { mailbox.run; true } catch {
|
||||||
case anything ⇒
|
case anything: Throwable ⇒
|
||||||
val t = Thread.currentThread
|
val t = Thread.currentThread
|
||||||
t.getUncaughtExceptionHandler match {
|
t.getUncaughtExceptionHandler match {
|
||||||
case null ⇒
|
case null ⇒
|
||||||
|
|
|
||||||
|
|
@ -688,7 +688,7 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
||||||
case NonFatal(e) ⇒
|
case NonFatal(e) ⇒
|
||||||
executor.reportFailure(new LogEventException(Debug("Future", getClass, e.getMessage), e))
|
executor.reportFailure(new LogEventException(Debug("Future", getClass, e.getMessage), e))
|
||||||
p complete Left(e)
|
p complete Left(e)
|
||||||
case t ⇒
|
case t: Throwable ⇒
|
||||||
p complete Left(new ExecutionException(t)); throw t
|
p complete Left(new ExecutionException(t)); throw t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ class Switch(startAsOn: Boolean = false) {
|
||||||
protected def transcend(from: Boolean, action: ⇒ Unit): Boolean = synchronized {
|
protected def transcend(from: Boolean, action: ⇒ Unit): Boolean = synchronized {
|
||||||
if (switch.compareAndSet(from, !from)) {
|
if (switch.compareAndSet(from, !from)) {
|
||||||
try action catch {
|
try action catch {
|
||||||
case e ⇒
|
case t: Throwable ⇒
|
||||||
switch.compareAndSet(!from, from) // revert status
|
switch.compareAndSet(!from, from) // revert status
|
||||||
throw e
|
throw t
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
} else false
|
} else false
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package akka.agent
|
package akka.agent
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import akka.dispatch.Await
|
import akka.dispatch.Await
|
||||||
import akka.util.Duration
|
import akka.util.Duration
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import akka.event.LoggingAdapter;
|
||||||
import com.typesafe.config.Config;
|
import com.typesafe.config.Config;
|
||||||
import com.typesafe.config.ConfigFactory;
|
import com.typesafe.config.ConfigFactory;
|
||||||
|
|
||||||
import static akka.japi.Util.manifest;
|
import static akka.japi.Util.classTag;
|
||||||
|
|
||||||
import static akka.actor.SupervisorStrategy.*;
|
import static akka.actor.SupervisorStrategy.*;
|
||||||
import static akka.pattern.Patterns.ask;
|
import static akka.pattern.Patterns.ask;
|
||||||
|
|
@ -146,7 +146,7 @@ public class FaultHandlingDocSample {
|
||||||
|
|
||||||
// Send current progress to the initial sender
|
// Send current progress to the initial sender
|
||||||
pipe(ask(counterService, GetCurrentCount, askTimeout)
|
pipe(ask(counterService, GetCurrentCount, askTimeout)
|
||||||
.mapTo(manifest(CurrentCount.class))
|
.mapTo(classTag(CurrentCount.class))
|
||||||
.map(new Mapper<CurrentCount, Progress>() {
|
.map(new Mapper<CurrentCount, Progress>() {
|
||||||
public Progress apply(CurrentCount c) {
|
public Progress apply(CurrentCount c) {
|
||||||
return new Progress(100.0 * c.count / totalCount);
|
return new Progress(100.0 * c.count / totalCount);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ Sockets are always created using the ``akka.zeromq.ZeroMQExtension``, for exampl
|
||||||
|
|
||||||
.. includecode:: code/docs/zeromq/ZeromqDocTestBase.java#pub-socket
|
.. includecode:: code/docs/zeromq/ZeromqDocTestBase.java#pub-socket
|
||||||
|
|
||||||
Above examples will create a ZeroMQ Publisher socket that is Bound to the port 1233 on localhost.
|
Above examples will create a ZeroMQ Publisher socket that is Bound to the port 21231 on localhost.
|
||||||
|
|
||||||
Similarly you can create a subscription socket, with a listener, that subscribes to all messages from the publisher using:
|
Similarly you can create a subscription socket, with a listener, that subscribes to all messages from the publisher using:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.actor.mailbox
|
package docs.actor.mailbox
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#imports
|
//#imports
|
||||||
import akka.actor.Props
|
import akka.actor.Props
|
||||||
|
|
||||||
|
|
@ -56,7 +58,7 @@ import akka.util.duration._
|
||||||
class MyMailboxType(systemSettings: ActorSystem.Settings, config: Config)
|
class MyMailboxType(systemSettings: ActorSystem.Settings, config: Config)
|
||||||
extends MailboxType {
|
extends MailboxType {
|
||||||
|
|
||||||
override def create(owner: Option[ActorRef], system: Option[ActorSystem]): MessageQueue = owner zip system headOption match {
|
override def create(owner: Option[ActorRef], system: Option[ActorSystem]): MessageQueue = (owner zip system) headOption match {
|
||||||
case Some((o, s: ExtendedActorSystem)) ⇒ new MyMessageQueue(o, s)
|
case Some((o, s: ExtendedActorSystem)) ⇒ new MyMessageQueue(o, s)
|
||||||
case None ⇒ throw new IllegalArgumentException(
|
case None ⇒ throw new IllegalArgumentException(
|
||||||
"requires an owner (i.e. does not work with BalancingDispatcher)")
|
"requires an owner (i.e. does not work with BalancingDispatcher)")
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.actor
|
package docs.actor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#imports1
|
//#imports1
|
||||||
import akka.actor.Actor
|
import akka.actor.Actor
|
||||||
import akka.actor.Props
|
import akka.actor.Props
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.actor
|
package docs.actor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#test-code
|
//#test-code
|
||||||
import akka.testkit.AkkaSpec
|
import akka.testkit.AkkaSpec
|
||||||
import akka.actor.Props
|
import akka.actor.Props
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.actor
|
package docs.actor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#all
|
//#all
|
||||||
//#imports
|
//#imports
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.actor
|
package docs.actor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#testkit
|
//#testkit
|
||||||
import akka.testkit.{ AkkaSpec, ImplicitSender, EventFilter }
|
import akka.testkit.{ AkkaSpec, ImplicitSender, EventFilter }
|
||||||
import akka.actor.{ ActorRef, Props, Terminated }
|
import akka.actor.{ ActorRef, Props, Terminated }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.actor
|
package docs.actor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#imports1
|
//#imports1
|
||||||
import akka.actor.Actor
|
import akka.actor.Actor
|
||||||
import akka.actor.Props
|
import akka.actor.Props
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.actor
|
package docs.actor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#imports
|
//#imports
|
||||||
import akka.dispatch.{ Promise, Future, Await }
|
import akka.dispatch.{ Promise, Future, Await }
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.agent
|
package docs.agent
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import akka.agent.Agent
|
import akka.agent.Agent
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
import akka.util.Timeout
|
import akka.util.Timeout
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package docs.camel
|
package docs.camel
|
||||||
|
|
||||||
object Consumers {
|
object Consumers {
|
||||||
{
|
def foo = {
|
||||||
//#Consumer1
|
//#Consumer1
|
||||||
import akka.camel.{ CamelMessage, Consumer }
|
import akka.camel.{ CamelMessage, Consumer }
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ object Consumers {
|
||||||
}
|
}
|
||||||
//#Consumer1
|
//#Consumer1
|
||||||
}
|
}
|
||||||
{
|
def bar = {
|
||||||
//#Consumer2
|
//#Consumer2
|
||||||
import akka.camel.{ CamelMessage, Consumer }
|
import akka.camel.{ CamelMessage, Consumer }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package docs.camel
|
package docs.camel
|
||||||
|
|
||||||
object Introduction {
|
object Introduction {
|
||||||
{
|
def foo = {
|
||||||
//#Consumer-mina
|
//#Consumer-mina
|
||||||
import akka.camel.{ CamelMessage, Consumer }
|
import akka.camel.{ CamelMessage, Consumer }
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ object Introduction {
|
||||||
val mina = sys.actorOf(Props[MinaClient])
|
val mina = sys.actorOf(Props[MinaClient])
|
||||||
//#Consumer-mina
|
//#Consumer-mina
|
||||||
}
|
}
|
||||||
{
|
def bar = {
|
||||||
//#Consumer
|
//#Consumer
|
||||||
import akka.camel.{ CamelMessage, Consumer }
|
import akka.camel.{ CamelMessage, Consumer }
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ object Introduction {
|
||||||
}
|
}
|
||||||
//#Consumer
|
//#Consumer
|
||||||
}
|
}
|
||||||
{
|
def baz = {
|
||||||
//#Producer
|
//#Producer
|
||||||
import akka.actor.Actor
|
import akka.actor.Actor
|
||||||
import akka.camel.{ Producer, Oneway }
|
import akka.camel.{ Producer, Oneway }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.dispatcher
|
package docs.dispatcher
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import org.scalatest.{ BeforeAndAfterAll, WordSpec }
|
import org.scalatest.{ BeforeAndAfterAll, WordSpec }
|
||||||
import org.scalatest.matchers.MustMatchers
|
import org.scalatest.matchers.MustMatchers
|
||||||
import akka.testkit.AkkaSpec
|
import akka.testkit.AkkaSpec
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.future
|
package docs.future
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import org.scalatest.{ BeforeAndAfterAll, WordSpec }
|
import org.scalatest.{ BeforeAndAfterAll, WordSpec }
|
||||||
import org.scalatest.matchers.MustMatchers
|
import org.scalatest.matchers.MustMatchers
|
||||||
import akka.testkit._
|
import akka.testkit._
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.io
|
package docs.io
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#imports
|
//#imports
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.util.{ ByteString, ByteStringBuilder }
|
import akka.util.{ ByteString, ByteStringBuilder }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.routing
|
package docs.routing
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import akka.routing.{ ScatterGatherFirstCompletedRouter, BroadcastRouter, RandomRouter, RoundRobinRouter }
|
import akka.routing.{ ScatterGatherFirstCompletedRouter, BroadcastRouter, RandomRouter, RoundRobinRouter }
|
||||||
import annotation.tailrec
|
import annotation.tailrec
|
||||||
import akka.actor.{ Props, Actor }
|
import akka.actor.{ Props, Actor }
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package docs.testkit
|
package docs.testkit
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
import language.implicitConversions
|
||||||
|
|
||||||
import org.specs2.Specification
|
import org.specs2.Specification
|
||||||
import org.specs2.specification.{ Step, Scope }
|
import org.specs2.specification.{ Step, Scope }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package docs.testkit
|
package docs.testkit
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import org.specs2.mutable.Specification
|
import org.specs2.mutable.Specification
|
||||||
import org.specs2.specification.Scope
|
import org.specs2.specification.Scope
|
||||||
import org.specs2.time.NoTimeConversions
|
import org.specs2.time.NoTimeConversions
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.testkit
|
package docs.testkit
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#testkit-usage
|
//#testkit-usage
|
||||||
import scala.util.Random
|
import scala.util.Random
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.testkit
|
package docs.testkit
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
//#imports-test-probe
|
//#imports-test-probe
|
||||||
import akka.testkit.TestProbe
|
import akka.testkit.TestProbe
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
package docs.transactor
|
package docs.transactor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.transactor._
|
import akka.transactor._
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package docs.zeromq
|
package docs.zeromq
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import akka.actor.Actor
|
import akka.actor.Actor
|
||||||
import akka.actor.Props
|
import akka.actor.Props
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
|
|
@ -30,7 +32,7 @@ object ZeromqDocSpec {
|
||||||
|
|
||||||
class HealthProbe extends Actor {
|
class HealthProbe extends Actor {
|
||||||
|
|
||||||
val pubSocket = context.system.newSocket(SocketType.Pub, Bind("tcp://127.0.0.1:1235"))
|
val pubSocket = ZeroMQExtension(context.system).newSocket(SocketType.Pub, Bind("tcp://127.0.0.1:1235"))
|
||||||
val memory = ManagementFactory.getMemoryMXBean
|
val memory = ManagementFactory.getMemoryMXBean
|
||||||
val os = ManagementFactory.getOperatingSystemMXBean
|
val os = ManagementFactory.getOperatingSystemMXBean
|
||||||
val ser = SerializationExtension(context.system)
|
val ser = SerializationExtension(context.system)
|
||||||
|
|
@ -64,7 +66,7 @@ object ZeromqDocSpec {
|
||||||
//#logger
|
//#logger
|
||||||
class Logger extends Actor with ActorLogging {
|
class Logger extends Actor with ActorLogging {
|
||||||
|
|
||||||
context.system.newSocket(SocketType.Sub, Listener(self), Connect("tcp://127.0.0.1:1235"), Subscribe("health"))
|
ZeroMQExtension(context.system).newSocket(SocketType.Sub, Listener(self), Connect("tcp://127.0.0.1:1235"), Subscribe("health"))
|
||||||
val ser = SerializationExtension(context.system)
|
val ser = SerializationExtension(context.system)
|
||||||
val timestampFormat = new SimpleDateFormat("HH:mm:ss.SSS")
|
val timestampFormat = new SimpleDateFormat("HH:mm:ss.SSS")
|
||||||
|
|
||||||
|
|
@ -90,7 +92,7 @@ object ZeromqDocSpec {
|
||||||
//#alerter
|
//#alerter
|
||||||
class HeapAlerter extends Actor with ActorLogging {
|
class HeapAlerter extends Actor with ActorLogging {
|
||||||
|
|
||||||
context.system.newSocket(SocketType.Sub, Listener(self), Connect("tcp://127.0.0.1:1235"), Subscribe("health.heap"))
|
ZeroMQExtension(context.system).newSocket(SocketType.Sub, Listener(self), Connect("tcp://127.0.0.1:1235"), Subscribe("health.heap"))
|
||||||
val ser = SerializationExtension(context.system)
|
val ser = SerializationExtension(context.system)
|
||||||
var count = 0
|
var count = 0
|
||||||
|
|
||||||
|
|
@ -121,11 +123,6 @@ class ZeromqDocSpec extends AkkaSpec("akka.loglevel=INFO") {
|
||||||
val pubSocket = ZeroMQExtension(system).newSocket(SocketType.Pub, Bind("tcp://127.0.0.1:21231"))
|
val pubSocket = ZeroMQExtension(system).newSocket(SocketType.Pub, Bind("tcp://127.0.0.1:21231"))
|
||||||
//#pub-socket
|
//#pub-socket
|
||||||
|
|
||||||
//#pub-socket2
|
|
||||||
import akka.zeromq._
|
|
||||||
val pubSocket2 = system.newSocket(SocketType.Pub, Bind("tcp://127.0.0.1:21232"))
|
|
||||||
//#pub-socket2
|
|
||||||
|
|
||||||
//#sub-socket
|
//#sub-socket
|
||||||
import akka.zeromq._
|
import akka.zeromq._
|
||||||
val listener = system.actorOf(Props(new Actor {
|
val listener = system.actorOf(Props(new Actor {
|
||||||
|
|
@ -135,11 +132,11 @@ class ZeromqDocSpec extends AkkaSpec("akka.loglevel=INFO") {
|
||||||
case _ ⇒ //...
|
case _ ⇒ //...
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
val subSocket = system.newSocket(SocketType.Sub, Listener(listener), Connect("tcp://127.0.0.1:21231"), SubscribeAll)
|
val subSocket = ZeroMQExtension(system).newSocket(SocketType.Sub, Listener(listener), Connect("tcp://127.0.0.1:21231"), SubscribeAll)
|
||||||
//#sub-socket
|
//#sub-socket
|
||||||
|
|
||||||
//#sub-topic-socket
|
//#sub-topic-socket
|
||||||
val subTopicSocket = system.newSocket(SocketType.Sub, Listener(listener), Connect("tcp://127.0.0.1:21231"), Subscribe("foo.bar"))
|
val subTopicSocket = ZeroMQExtension(system).newSocket(SocketType.Sub, Listener(listener), Connect("tcp://127.0.0.1:21231"), Subscribe("foo.bar"))
|
||||||
//#sub-topic-socket
|
//#sub-topic-socket
|
||||||
|
|
||||||
//#unsub-topic-socket
|
//#unsub-topic-socket
|
||||||
|
|
@ -155,7 +152,7 @@ class ZeromqDocSpec extends AkkaSpec("akka.loglevel=INFO") {
|
||||||
system.stop(subTopicSocket)
|
system.stop(subTopicSocket)
|
||||||
|
|
||||||
//#high-watermark
|
//#high-watermark
|
||||||
val highWatermarkSocket = system.newSocket(
|
val highWatermarkSocket = ZeroMQExtension(system).newSocket(
|
||||||
SocketType.Router,
|
SocketType.Router,
|
||||||
Listener(listener),
|
Listener(listener),
|
||||||
Bind("tcp://127.0.0.1:21233"),
|
Bind("tcp://127.0.0.1:21233"),
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,8 @@ Sockets are always created using the ``akka.zeromq.ZeroMQExtension``, for exampl
|
||||||
|
|
||||||
.. includecode:: code/docs/zeromq/ZeromqDocSpec.scala#pub-socket
|
.. includecode:: code/docs/zeromq/ZeromqDocSpec.scala#pub-socket
|
||||||
|
|
||||||
or by importing the ``akka.zeromq._`` package to make newSocket method available on system, via an implicit conversion.
|
|
||||||
|
|
||||||
.. includecode:: code/docs/zeromq/ZeromqDocSpec.scala#pub-socket2
|
Above examples will create a ZeroMQ Publisher socket that is Bound to the port 1233 on localhost.
|
||||||
|
|
||||||
|
|
||||||
Above examples will create a ZeroMQ Publisher socket that is Bound to the port 1234 on localhost.
|
|
||||||
|
|
||||||
Similarly you can create a subscription socket, with a listener, that subscribes to all messages from the publisher using:
|
Similarly you can create a subscription socket, with a listener, that subscribes to all messages from the publisher using:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package akka.actor.mailbox
|
package akka.actor.mailbox
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils
|
import org.apache.commons.io.FileUtils
|
||||||
import akka.dispatch.Mailbox
|
import akka.dispatch.Mailbox
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ trait NetworkFailureSpec extends DefaultTimeout { self: AkkaSpec ⇒
|
||||||
Thread.sleep(duration.toMillis)
|
Thread.sleep(duration.toMillis)
|
||||||
restoreIP
|
restoreIP
|
||||||
} catch {
|
} catch {
|
||||||
case e ⇒
|
case e: Throwable ⇒
|
||||||
dead.set(true)
|
dead.set(true)
|
||||||
e.printStackTrace
|
e.printStackTrace
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ trait NetworkFailureSpec extends DefaultTimeout { self: AkkaSpec ⇒
|
||||||
Thread.sleep(duration.toMillis)
|
Thread.sleep(duration.toMillis)
|
||||||
restoreIP
|
restoreIP
|
||||||
} catch {
|
} catch {
|
||||||
case e ⇒
|
case e: Throwable ⇒
|
||||||
dead.set(true)
|
dead.set(true)
|
||||||
e.printStackTrace
|
e.printStackTrace
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ trait NetworkFailureSpec extends DefaultTimeout { self: AkkaSpec ⇒
|
||||||
Thread.sleep(duration.toMillis)
|
Thread.sleep(duration.toMillis)
|
||||||
restoreIP
|
restoreIP
|
||||||
} catch {
|
} catch {
|
||||||
case e ⇒
|
case e: Throwable ⇒
|
||||||
dead.set(true)
|
dead.set(true)
|
||||||
e.printStackTrace
|
e.printStackTrace
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
package akka.transactor
|
package akka.transactor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import akka.actor.{ Actor, ActorRef }
|
import akka.actor.{ Actor, ActorRef }
|
||||||
import scala.concurrent.stm.InTxn
|
import scala.concurrent.stm.InTxn
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,20 @@
|
||||||
|
|
||||||
package akka.transactor
|
package akka.transactor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import org.scalatest.BeforeAndAfterAll
|
import org.scalatest.BeforeAndAfterAll
|
||||||
|
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.dispatch.Await
|
import akka.dispatch.Await
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
import akka.util.Timeout
|
|
||||||
import akka.testkit._
|
import akka.testkit._
|
||||||
import akka.testkit.TestEvent.Mute
|
import akka.testkit.TestEvent.Mute
|
||||||
import scala.concurrent.stm._
|
import scala.concurrent.stm._
|
||||||
import scala.util.Random.{ nextInt ⇒ random }
|
import scala.util.Random.{ nextInt ⇒ random }
|
||||||
import java.util.concurrent.CountDownLatch
|
import java.util.concurrent.CountDownLatch
|
||||||
import akka.pattern.{ AskTimeoutException, ask }
|
import akka.pattern.{ AskTimeoutException, ask }
|
||||||
|
import akka.util.{ NonFatal, Timeout }
|
||||||
|
|
||||||
object FickleFriends {
|
object FickleFriends {
|
||||||
case class FriendlyIncrement(friends: Seq[ActorRef], timeout: Timeout, latch: CountDownLatch)
|
case class FriendlyIncrement(friends: Seq[ActorRef], timeout: Timeout, latch: CountDownLatch)
|
||||||
|
|
@ -49,7 +51,7 @@ object FickleFriends {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
case _ ⇒ () // swallow exceptions
|
case NonFatal(_) ⇒ () // swallow exceptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
package akka.transactor
|
package akka.transactor
|
||||||
|
|
||||||
|
import language.postfixOps
|
||||||
|
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.dispatch.Await
|
import akka.dispatch.Await
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,15 @@ import Sphinx.{ sphinxDocs, sphinxHtml, sphinxLatex, sphinxPdf, sphinxPygments,
|
||||||
object AkkaBuild extends Build {
|
object AkkaBuild extends Build {
|
||||||
System.setProperty("akka.mode", "test") // Is there better place for this?
|
System.setProperty("akka.mode", "test") // Is there better place for this?
|
||||||
|
|
||||||
|
lazy val desiredScalaVersion = "2.10.0-M4"
|
||||||
|
|
||||||
lazy val buildSettings = Seq(
|
lazy val buildSettings = Seq(
|
||||||
organization := "com.typesafe.akka",
|
organization := "com.typesafe.akka",
|
||||||
version := "2.1-SNAPSHOT",
|
version := "2.1-SNAPSHOT",
|
||||||
//scalaVersion := "2.10.0-M4"
|
//scalaVersion := "2.10.0-M4"
|
||||||
scalaVersion := "2.10.0-SNAPSHOT",
|
scalaVersion := "2.10.0-SNAPSHOT",
|
||||||
scalaVersion in update <<= (scalaVersion) apply {
|
scalaVersion in update <<= (scalaVersion) apply {
|
||||||
case "2.10.0-SNAPSHOT" => "2.10.0-M4"
|
case "2.10.0-SNAPSHOT" => desiredScalaVersion
|
||||||
case x => x
|
case x => x
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -48,7 +50,7 @@ object AkkaBuild extends Build {
|
||||||
sphinxLatex <<= sphinxLatex in LocalProject(docs.id),
|
sphinxLatex <<= sphinxLatex in LocalProject(docs.id),
|
||||||
sphinxPdf <<= sphinxPdf in LocalProject(docs.id)
|
sphinxPdf <<= sphinxPdf in LocalProject(docs.id)
|
||||||
),
|
),
|
||||||
aggregate = Seq(actor, testkit, actorTests, remote, remoteTests, camel, cluster, slf4j, agent, transactor, mailboxes, zeroMQ, kernel, akkaSbtPlugin, samples, tutorials, docs)
|
aggregate = Seq(actor, testkit, actorTests, remote, remoteTests, camel, cluster, slf4j, agent, transactor, mailboxes, zeroMQ, kernel, /*akkaSbtPlugin,*/ samples, tutorials, docs)
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val actor = Project(
|
lazy val actor = Project(
|
||||||
|
|
@ -299,6 +301,7 @@ object AkkaBuild extends Build {
|
||||||
|
|
||||||
override lazy val settings = super.settings ++ buildSettings ++ Seq(
|
override lazy val settings = super.settings ++ buildSettings ++ Seq(
|
||||||
resolvers += "Sonatype Snapshot Repo" at "https://oss.sonatype.org/content/repositories/snapshots/",
|
resolvers += "Sonatype Snapshot Repo" at "https://oss.sonatype.org/content/repositories/snapshots/",
|
||||||
|
resolvers += "Sonatype Releases Repo" at "https://oss.sonatype.org/content/repositories/releases/",
|
||||||
shellPrompt := { s => Project.extract(s).currentProject.id + " > " }
|
shellPrompt := { s => Project.extract(s).currentProject.id + " > " }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -446,9 +449,7 @@ object AkkaBuild extends Build {
|
||||||
object Dependencies {
|
object Dependencies {
|
||||||
import Dependency._
|
import Dependency._
|
||||||
|
|
||||||
val actor = Seq(
|
val actor = Seq(config)
|
||||||
config
|
|
||||||
)
|
|
||||||
|
|
||||||
val testkit = Seq(Test.scalatest, Test.junit)
|
val testkit = Seq(Test.scalatest, Test.junit)
|
||||||
|
|
||||||
|
|
@ -480,28 +481,31 @@ object Dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
object Dependency {
|
object Dependency {
|
||||||
|
|
||||||
|
def v(a: String): String = a+"_"+AkkaBuild.desiredScalaVersion
|
||||||
|
|
||||||
// Compile
|
// Compile
|
||||||
val config = "com.typesafe" % "config" % "0.4.1" // ApacheV2
|
val config = "com.typesafe" % "config" % "0.4.1" // ApacheV2
|
||||||
val camelCore = "org.apache.camel" % "camel-core" % "2.8.0" // ApacheV2
|
val camelCore = "org.apache.camel" % "camel-core" % "2.8.0" // ApacheV2
|
||||||
val netty = "io.netty" % "netty" % "3.5.0.Final" // ApacheV2
|
val netty = "io.netty" % "netty" % "3.5.1.Final" // ApacheV2
|
||||||
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.4.1" // New BSD
|
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.4.1" // New BSD
|
||||||
val scalaStm = "org.scala-tools" %% "scala-stm" % "0.5" // Modified BSD (Scala)
|
val scalaStm = "org.scala-tools" % v("scala-stm") % "0.5" // Modified BSD (Scala)
|
||||||
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.6.4" // MIT
|
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.6.4" // MIT
|
||||||
val zeroMQ = "org.zeromq" %% "zeromq-scala-binding" % "0.0.6" // ApacheV2 //FIXME SWITCH TO OFFICIAL VERSION
|
val zeroMQ = "org.zeromq" % v("zeromq-scala-binding") % "0.0.6" // ApacheV2 //FIXME SWITCH TO OFFICIAL VERSION
|
||||||
val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" // ApacheV2
|
val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" // ApacheV2
|
||||||
|
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
object Test {
|
object Test {
|
||||||
val commonsMath = "org.apache.commons" % "commons-math" % "2.1" % "test" // ApacheV2
|
val commonsMath = "org.apache.commons" % "commons-math" % "2.1" % "test" // ApacheV2
|
||||||
val commonsIo = "commons-io" % "commons-io" % "2.0.1" % "test" // ApacheV2
|
val commonsIo = "commons-io" % "commons-io" % "2.0.1" % "test" // ApacheV2
|
||||||
val junit = "junit" % "junit" % "4.10" % "test" // Common Public License 1.0
|
val junit = "junit" % "junit" % "4.10" % "test" // Common Public License 1.0
|
||||||
val logback = "ch.qos.logback" % "logback-classic" % "1.0.4" % "test" // EPL 1.0 / LGPL 2.1
|
val logback = "ch.qos.logback" % "logback-classic" % "1.0.4" % "test" // EPL 1.0 / LGPL 2.1
|
||||||
val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT
|
val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT
|
||||||
val scalatest = "org.scalatest" %% "scalatest" % "1.9-2.10.0-M4-B2" % "test" // ApacheV2
|
val scalatest = "org.scalatest" % v("scalatest") % "1.9-2.10.0-M4-B2" % "test" // ApacheV2
|
||||||
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.10.0-b1" % "test" // New BSD
|
val scalacheck = "org.scalacheck" % v("scalacheck") % "1.10.0-b1" % "test" // New BSD
|
||||||
val specs2 = "org.specs2" %% "specs2" % "1.11" % "test" // Modified BSD / ApacheV2
|
val specs2 = "org.specs2" % "specs2_2.10" % "1.11" % "test" // Modified BSD / ApacheV2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue