Hi, Elias,

That sounds an awesome addition to the Samza eco-system! Do you have a plan
to open-source your JRuby version of Hello Samza job? It would be awesome!

Thanks a lot!

-Yi

On Wed, Sep 23, 2015 at 4:13 PM, Elias Levy <fearsome.lucid...@gmail.com>
wrote:

> I am exploring Samza for some of our use cases.  As we have a lot of Ruby
> developers, I decided to determine if we could use JRuby with Samza.  After
> some work, I've been able to write Ruby jobs. To demonstrate the details,
> I've ported the Hello Samza project to JRuby.  You can find the port at
> https://github.com/eliaslevy/samza-hello-samza-jruby.
>
> The port largely straightforward once the right pieces were found.  It
> makes use of an existing Maven plug-in to compile the Ruby sources to Java
> sources, which are then compiled as usual.  It also makes use of an
> existing Maven plugin and the Maven proxy at rubygems-proxy.torquebox.org
> to enable the use of Ruby gems within tasks.
>
> That said, there were two complications.  A bug in JRuby generated bad Java
> source when a Ruby class attempted to implement more than one interface.  I
> fixed this in JRuby and the fix should be included in the next release.  In
> the mean time, you'll have to use JRuby 1.7.23-SNAPSHOT.  As there appears
> to be no JRuby Maven repository with the snapshot artifacts, you'll have to
> build them yourself from the JRuby source and place them in your local
> repo.
>
> The second complication is that JRuby won't let you inherit from a class
> when you use the JRuby compiler.  That means you can't
> subclass BlockingEnvelopeMap to pick up its poll implementation. One could
> get around this by writing a bit of Java to implement a class that inherits
> from BlockingEnvelopeMap.  Instead, I abused the FileReaderSystemConsumer
> class by instantiating it and proxying calls to it from my SystemConsumer
> to gain access to the BlockingEnvelopeMap implementation.
>
> The main difference between the JRuby implementation of Hello Samza and the
> original is that I replaced the Java IRC library with a Ruby gem to
> demonstrate their use.
>
> I hope this helps someone.
>
> Elias
>

Reply via email to