Scala/Akka and JRuby

Hi everyone,

is there anyone that uses akka/scala together with jruby?

kind regards,
Alex

I am using Akka actors to process a data stream from Kafka. Similar to a
traditional ETL approach except with parallel processing branches.
Its been good so far. Took a bit to fully embrace the let it fail design
mentality.

I started with the Mikka gem here:

and I created a fork to add enhancements I needed along the way

Cheers,
Mike

(replies inline)

On Wed, 01 Oct 2014, Alexander Fitterling wrote:

Hi everyone,

is there anyone that uses akka/scala together with jruby?

While not using Akka directly, The concurrent-ruby gem is well supported
on
JRuby and provides lots of the same concepts that Akka and Scala have:
https://github.com/ruby-concurrency/concurrent-ruby

  • R. Tyler C.

I use Akka extensively with jruby in
https://github.com/gamemachine/gamemachine.

It pretty much just works. Only one thing I can think of that might
throw
someone is that Akka now requires a factory for creating actors. So you
have to jump through a couple of hoops to make that work when your
factory
is ruby and your actors are ruby classes that inherit from UntypedActor.

My abstraction layer for actors is in server/lib/game_machine/actor.

If you look at builder.rb and factory.rb, and also in the java class
ActorFactory, you should see how it all fits together. Basically I
have a
java factory that is just a proxy to my ruby factory, and a java
interface
to make it possible for java to call the create method on my ruby
factory
instance.

Only reason I haven’t broken out the actor abstractions into a separate
gem
is I just haven’t had people asking for it, but my project is fairly
niche
and not really targeted at what most people use jruby for, so I’m unsure
how much of a demand there really is.

Chris

Mike,
thank you.
Am I able to run a parent actor on jruby and implement all child actors
in scala? so as they still would share the same environment?
Secondly: I was seeking informations on how to run scala code at all
from jruby. Couldn’t find something. Are there any hints?
kind regards,
Alex

Am 01.10.2014 um 18:43 schrieb Mike L. [email protected]:

ic, thank you indeed.
kind regards,
Alex

Am 01.10.2014 um 18:49 schrieb R. Tyler C. [email protected]:

Yes you can have jruby parent actors that have scala or java children
and
visa versa.

Scala classes compile to java bytecode. You access scala classes just
like
java classes for the most part. Here is some info from the jruby docs
on
the subject.

On Sun, Oct 5, 2014 at 5:04 AM, Alexander Fitterling <

Mike, it works. Do you know if I can use akkas microkernel as well?
kind regards,
Alex

Am 05.10.2014 um 22:38 schrieb snacktime [email protected]:

I havent tried it myself. However, it seems all you would need to do is
implement the Bootable interface.
http://doc.akka.io/japi/akka/2.2.4/index.html?akka/kernel/Bootable.html

Cheers,
Mike