From 56bd8a6882808082391d29317e912c8ce1d2c98b Mon Sep 17 00:00:00 2001 From: Ivan Porto Carrero Date: Fri, 20 Jan 2012 09:27:23 +0100 Subject: [PATCH] Adds missing docs and/or return types --- akka-docs/scala/zeromq.rst | 4 +--- .../src/main/scala/akka/zeromq/Response.scala | 18 +++++++++++++++ .../main/scala/akka/zeromq/Responses.scala | 8 ------- .../main/scala/akka/zeromq/SocketOption.scala | 22 +++++++++---------- 4 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 akka-zeromq/src/main/scala/akka/zeromq/Response.scala delete mode 100644 akka-zeromq/src/main/scala/akka/zeromq/Responses.scala diff --git a/akka-docs/scala/zeromq.rst b/akka-docs/scala/zeromq.rst index b21c81d9c4..e080979910 100644 --- a/akka-docs/scala/zeromq.rst +++ b/akka-docs/scala/zeromq.rst @@ -8,8 +8,6 @@ ZeroMQ .. contents:: :local: -Module stability: **IN PROGRESS** - Akka provides a ZeroMQ module which abstracts a ZeroMQ connection and therefore allows interaction between Akka actors to take place over ZeroMQ connections. The messages can be of a proprietary format or they can be defined using Protobuf. The socket actor is fault-tolerant by default and when you use the newSocket method to create new sockets it will properly reinitialize the socket. ZeroMQ is very opinionated when it comes to multi-threading so configuration option `akka.zeromq.socket-dispatcher` always needs to be configured to a PinnedDispatcher, because the actual ZeroMQ socket can only be accessed by the thread that created it. @@ -29,7 +27,7 @@ ZeroMQ supports multiple connectivity patterns, each aimed to meet a different s will create a ZeroMQ Publisher socket that is Bound to the port 1234 on localhost. Importing the akka.zeromq._ package ensures that the implicit zeromq method is available. -Similarly you can create a subscribtion socket, that subscribes to all messages from the publisher using: +Similarly you can create a subscription socket, that subscribes to all messages from the publisher using: .. code-block:: scala diff --git a/akka-zeromq/src/main/scala/akka/zeromq/Response.scala b/akka-zeromq/src/main/scala/akka/zeromq/Response.scala new file mode 100644 index 0000000000..f916ba0a4f --- /dev/null +++ b/akka-zeromq/src/main/scala/akka/zeromq/Response.scala @@ -0,0 +1,18 @@ +/** + * Copyright (C) 2009-2011 Typesafe Inc. + */ +package akka.zeromq + +/** + * Base trait for the events raised by a ZeroMQ socket actor + */ +sealed trait Response + +/** + * When the ZeroMQ socket connects it sends this message to a listener + */ +case object Connecting extends Response +/** + * When the ZeroMQ socket disconnects it sends this message to a listener + */ +case object Closed extends Response diff --git a/akka-zeromq/src/main/scala/akka/zeromq/Responses.scala b/akka-zeromq/src/main/scala/akka/zeromq/Responses.scala deleted file mode 100644 index 43200a959c..0000000000 --- a/akka-zeromq/src/main/scala/akka/zeromq/Responses.scala +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (C) 2009-2011 Typesafe Inc. - */ -package akka.zeromq - -sealed trait Response -case object Connecting extends Response -case object Closed extends Response diff --git a/akka-zeromq/src/main/scala/akka/zeromq/SocketOption.scala b/akka-zeromq/src/main/scala/akka/zeromq/SocketOption.scala index ad01e90d47..41d7cf867c 100644 --- a/akka-zeromq/src/main/scala/akka/zeromq/SocketOption.scala +++ b/akka-zeromq/src/main/scala/akka/zeromq/SocketOption.scala @@ -8,6 +8,7 @@ import org.zeromq.{ ZMQ ⇒ JZMQ } import akka.actor.ActorRef import akka.util.duration._ import akka.util.Duration +import org.zeromq.ZMQ.{Poller, Socket} /** * Marker trait representing request messages for zeromq @@ -55,27 +56,24 @@ case class Connect(endpoint: String) extends SocketConnectOption * Companion object for a ZeroMQ I/O thread pool */ object Context { - def apply(numIoThreads: Int = 1) = new Context(numIoThreads) + def apply(numIoThreads: Int = 1): Context = new Context(numIoThreads) } /** * Represents an I/O thread pool for ZeroMQ sockets. - * By default the ZeroMQ module uses a thread pool with 1 thread. For most applications that should be - * sufficient + * By default the ZeroMQ module uses an I/O thread pool with 1 thread. + * For most applications that should be sufficient * * @param numIoThreads */ class Context(numIoThreads: Int) extends SocketMeta { private val context = JZMQ.context(numIoThreads) - def socket(socketType: SocketType.ZMQSocketType) = { - context.socket(socketType.id) - } - def poller = { - context.poller - } - def term = { - context.term - } + + def socket(socketType: SocketType.ZMQSocketType): Socket = context.socket(socketType.id) + + def poller: Poller = context.poller + + def term: Unit = context.term } /**