Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JRuby experiences

JRuby experiences

Small talk from BCNonRails monthly meeting

Avatar for Mauro Asprea

Mauro Asprea

January 17, 2013
Tweet

Other Decks in Programming

Transcript

  1. Me: Mauro Asprea Github: /brutuscat Twitter: @brutuscat E-mail: [email protected] I

    am a Freelancer. I love to try and build things. I am Pragmatic
  2. So JRuby Ruby running in the JVM Java running on

    Ruby JVM Integration components JVM Speed (sometimes) Limitations • Can't fork • Some gems using C extensions won't work
  3. Java My experience with it was not that good. Keywords,

    patterns everywhere, it is not that easy to "discover" But it was "easy" to integrate things. Because is so Enterprise, it needs integration tools As long as you can program it... Many stuff are explained with XML. Which I HATE
  4. Stuff: FTP Dropbox Connect to your Dropbox using ubiquitous FTP

    client. But there's no "good" FTP Server in Ruby Solution: • Use FTPServer from ASF • Programmatically be a virtual FTPServer
  5. Stuff: FTP Dropbox Basically 3 things: • List files ◦

    /metadata • Download ◦ /files GET • Upload ◦ /chunked_upload
  6. Stuff 2: Camel-FIX-Websockets A "server" to push Financial Information (FIX)

    to the client Solution: • Camel as an integration framework • Quickfix/j as a FIX library • Jetty as a http server • Ruby instead of Java
  7. Camel is GOOD: • Nice DSL for "dataflow" programming •

    Lots of components ◦ Quickfix ◦ Websocket ◦ Mongodb ◦ Everything? • "easy" to extend/fix using Ruby metaprogramming Stuff 2: Camel-FIX-Websockets
  8. Stuff 2: Camel-FIX-Websockets JRuby caveats: • Because of its "reflective"

    nature, everything has to be a proper Java object obj.become_java!.newInstance For writing real Java classes
  9. Tips • Naming issues? Wrap • Use PRY for "object

    discovery" • Add your directories in the classpath (log4j, configuration, etc) • For best performance wrap your Java objects instead of using Ruby objects (see JrJackson)
  10. Ideas Embed-ness: • Apache James: smtp, pop3, imap, nntp, etc

    • Apache sshd: ssh client/server ◦ http://dylanv.org/2012/10/01/building-ssh-services- with-jruby-and-apache-mina/ • Jetty: http, spdy, websockets, servlet container • Jython, JS, anything?
  11. Me: Mauro Asprea Thank you! E-mail: [email protected] I am a

    Freelancer. I love to try and build things. I am Pragmatic