Created
August 1, 2012 03:16
-
-
Save ayosec/3223304 to your computer and use it in GitHub Desktop.
Akka on JRuby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "jbundler" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "http://repo.typesafe.com/typesafe/releases/" | |
jar "com.typesafe.akka:akka-actor", "2.0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
buena mierda :)