Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created August 1, 2012 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayosec/3223304 to your computer and use it in GitHub Desktop.
Save ayosec/3223304 to your computer and use it in GitHub Desktop.
Akka on JRuby
gem "jbundler"
source "http://repo.typesafe.com/typesafe/releases/"
jar "com.typesafe.akka:akka-actor", "2.0.2"
require "bundler/setup"
require "jbundler"
require "java"
java_import "akka.actor.ActorSystem"
java_import "akka.actor.UntypedActor"
java_import "akka.actor.UntypedActorFactory"
java_import "akka.actor.Props"
class Someone < UntypedActor
def onReceive(message)
puts "onReceive: #{message}"
getContext.system.shutdown
sleep 1
puts "Close"
end
end
class SomeoneFactory
java_implements UntypedActorFactory
def create
Someone.new
end
end
system = ActorSystem.apply("test-system")
someone = system.actorOf(Props.new(SomeoneFactory.new))
someone.tell "hello"
system.awaitTermination
@albertoperdomo
Copy link

buena mierda :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment