Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Devignition 2011

3,850 views

Published on

Published in: Technology
  • Be the first to comment

Devignition 2011

  1. 1. The Polyglot Future of JBoss AS Toby Crawley Red Hat, Inc.
  2. 2. PresentThe Polyglot Future of JBoss AS Toby Crawley Red Hat, Inc.
  3. 3. Yours Truly• Senior SW Engineer at Red Hat• Core developer on TorqueBox & Immutant• Member of Project:Odd• @tcrawley
  4. 4. Agenda• intro• JBoss AS• JRuby & TorqueBox• Clojure & Immutant• crap, a demo• outro
  5. 5. JBoss AS 7• Low memory footprint• Modularized class loader isolation• Fast startup time• Performant• EE6
  6. 6. “Java is a DSL for takinglarge XML files andconverting them to stacktraces” Scott Bellware
  7. 7. GoalLeverage the AS as a platform to reduce some of the accidental complexity of your deployment environment and allow you to use the best tool for the job.
  8. 8. GoalTo make you more productive.
  9. 9. GoalTo make you happy.
  10. 10. Ruby• Expressive• Dynamic typing• Less ceremony• Makes you feel more cleverer
  11. 11. Set<Person> people = new HashSet<Person>();for ( Team each : teams ) { people.addAll( each.getMembers() );}for ( Person each : people ) { each.promote();}
  12. 12. teams. collect(&:members). flatten.uniq.each(&:promote!)
  13. 13. JRuby• Real threads• Simple access to Java• Fastest Ruby implementation
  14. 14. require javabar = org.projectodd.foo.Bar.newbar.a_value = 42bar.bazerize
  15. 15. TorqueBox is an Application Server forRuby built on top of JBoss AS7
  16. 16. Ruby!APIs!/!Programming!Models Java!APIs!/!Programming!Models Message Processors Polyglot WebSockets InjectionSinatra Rails Jobs STOMP POJO REST Servlet Rack Daemons Tasks Spring JMS JavaEE JRuby!Component!Deployers!&!Gems Java!Enterprise!Services JBoss Web Messaging Infinispan Cache TorqueBox HornetQ Transactions Core Quartz Security TorqueBox Core PicketLink JRuby with JIT Managed Services Container Java Virtual Machine
  17. 17. WebSupports any Rack framework (Rails,Sinata, Padrino, etc). Requests come in,responses go out. Works like you wouldexpect...
  18. 18. Web...but no war required. Just pointTorqueBox at the application root.
  19. 19. Scheduled JobsSimple cron-like scheduling that sharesyour applications lifecycle.
  20. 20. Scheduled Jobsclass TPSReportJob def run # work happens here endend
  21. 21. Scheduled JobsTorqueBox.configure do job TPSReportJob, :cron => 0 */5 * * * ?end
  22. 22. BackgroundableAsynchronous execution with a simpleapi. Shares your applications lifecycle.
  23. 23. Backgroundableinclude TorqueBox::Messagingclass User include Backgroundable always_background :send_welcome def send_welcome # slow email process endend
  24. 24. MessagingLayered on top of JMS and HornetQ.Useful for decoupling or polyglot interop.
  25. 25. Messagingqueue = inject( /queue/morris_day )queue.publish( Time.now )puts queue.receive# Fri Dec 2 16:44:22 -0500 2011
  26. 26. Messaginginclude TorqueBox::Messagingclass TheTime < MessageProcessor def on_message(body) # What time is it?!? puts body endend
  27. 27. MessagingTorqueBox.configure do queue /queue/morris_day do processor TheTime endend
  28. 28. ServicesLong running daemons that share theapplications lifecycle.
  29. 29. Injectionaka Inversion of Control. Telling thecontainer what you need and letting itwire things up.
  30. 30. Distributed TransactionsTrue multi-resource distributedtransactions.
  31. 31. Things I Skipped• Built-in WebSockets• Simple clustering• Key/Value store via Infinispan (Caching)
  32. 32. Clojure• Modern Lisp for the JVM• Functional• Immutable data• Concise syntax• Nice Java integration
  33. 33. Set<Person> people = new HashSet<Person>();for ( Team each : teams ) { people.addAll( each.getMembers() );}for ( Person each : people ) { each.promote();}
  34. 34. (map promote! (set (extract :members teams)))
  35. 35. (def extract mapcat)(map promote! (set (extract :members teams)))
  36. 36. (doto (org.projectodd.foo.Bar.) (.setAValue 42) (.bazerize))
  37. 37. Immutant
  38. 38. Immutant is an Application Server forClojure being built on top of JBoss AS7
  39. 39. WebSupports Ring handlers. Works like youwould expect. Requests come in,responses go out. Endpoints can becreated dynamically.
  40. 40. Web(require [immutant.web :as web])(defn my-ring-handler [request] ;; process request here)(web/start "/" my-ring-handler)...(web/stop "/")
  41. 41. MessagingLayered on top of JMS and HornetQ.Useful for decoupling or polyglot interop.
  42. 42. Messaging(require [immutant.messaging :as msg])(def q "/queue/morris_day")(msg/start q)(msg/publish q (Date.))(println (msg/receive q)); #<Date Fri Dec 2 16:54:56 EST 2011>
  43. 43. Messaging(msg/listen "/queue/morris_day" (fn [body] ;; What time is it?!? (println body)))
  44. 44. DaemonsLong running daemons that share theapplications lifecycle.
  45. 45. Coming Soon• Scheduled Jobs• Distributed futures• Distributed state• Multi-resource transactions• Injection• You tell us!
  46. 46. http://www.flickr.com/photos/-lucaslove/5084345964/
  47. 47. http://www.flickr.com/photos/jdgoring/179412740/
  48. 48. Clojuretwitter daemon queue Ruby Java processor TweetClassifier web topic sockets you! and you? and you!
  49. 49. Language LOC Ruby ~110 Clojure ~50 Java ~30Javascript ~25
  50. 50. Availability• TorqueBox: 2.0.0.beta1 released today• Immutant: incremental builds available
  51. 51. Availability Monday• TorqueBox: 2.0.0.beta1 released today• Immutant: incremental builds available
  52. 52. http://www.flickr.com/photos/daveynin/4194763701/
  53. 53. Resources• http://torquebox.org• #torquebox on freenode• @torquebox• http://immutant.org• #immutant on freenode• @immutants
  54. 54. http://www.flickr.com/photos/thaths/3760407774/

×