Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An integration of Akka with ZeroMQ
Scala Ruby
branch: next

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
project
src
.gitignore
README.md
build.sbt

README.md

A transport for akka with zeromq.

This is pretty much a work in progress. At this moment we have reliable client to server broker.

How to run the tests?

  1. Build/install the jzmq library
  2. Add -Djava.library.path=/path/to/jzmq to your xsbt startup script
  3. run the test suite:
sbt test

example xsbt script:

#!/bin/sh
java -Xms512m -Xmx1024m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled  -Djava.library.path=/usr/local/lib:/usr/lib -Dfile.encoding='UTF-8' -jar `dirname $0`/sbt-launch.jar "$@"

How is it put together?

This library starts with the idea that you want to create custom 0mq devices.
And different applications have different needs so this library (ab)uses stackable traits so that a 0mq device becomes composable.
You can add pubsub by just mixing in a trait.

This library does invert the idea that 0mq has about pubsub. This pubsub only works on TCP but there is publisher side filtering instead of subscriber side filtering.

For example to create the simplest implementation of a client/server paradigm

/* the server device */
ZeroMQ startDevice {
  new BackchatZeroMqDevice(serverConfig) with ServerActorBridge {
    val routerAddress = serverConfig.serverAddress
  }
}
val serverBridge = actorOf(new ZeroMqBridge(context, serverConfig.name) with ServerBridge).start()


/* the client device */
ZeroMQ startDevice {
  new BackchatZeroMqDevice(clientConfig) with ClientActorBridge with ClientBroker {
    val outboundAddress = clientConfig.serverAddress
    override def init() {
      super.init()
      clientLatch.open()
    }
  }
}
val clientBridge = actorOf(new ZeroMqBridge(context, clientConfig.name) with ClientBridge).start()

/* Getting a result from the server */
(clientBridge ? Request(serverActorName)).as[ResponseObject]

If you want to add reliable pubsub

val serverBroker = ZeroMQ startDevice {
  new BackchatZeroMqDevice(serverConfig) with ServerActorBridge with ServerPubSubPublisher {
    val routerAddress = serverConfig.serverAddress
  }
}
val serverBridge = actorOf(new ZeroMqBridge(context, serverConfig.name) with ServerBridge with PublisherBridge).start()

val clientBroker = ZeroMQ startDevice {
  new BackchatZeroMqDevice(clientConfig) with ClientActorBridge with ClientBroker with ClientPubSubSubscriber {
    val outboundAddress = clientConfig.serverAddress
  }
}
val clientBridge = actorOf(new ZeroMqBridge(context, clientConfig.name) with ClientBridge with SubscriberBridge).start()
Something went wrong with that request. Please try again.