When Ruby                             Meets Java                     T h e   Powe r   o f To r q u e b o xMonday 26 March 12
About Us               A r   u n A g r aw a l                -    2 8 0 + c o m m i t s i n R a i l s c o re              ...
ToDo        - T h e E n t e r p r i s e        - W h a t i s To r q u e b o x        - D e m o          - S c h e d u l i ...
Pop Quiz      Coolest Thing    About JRuby(1.6) ?Monday 26 March 12
The EnterpriseMonday 26 March 12
What If...      Wouldn’t it be great if            - I could use the power of Java libraries with the ease of            R...
TORQUEBOX                      Built upon JBoss 7                      Built using JRuby (1.6.7)                      Supp...
TORQUEBOXMonday 26 March 12
Installation         - Download the distribution from torquebox.org         OR         - rvm jruby (1.6.7)            jrub...
Our Sh***y AppMonday 26 March 12
Scheduling               Uses the battle-tested Quartz Java library               Zero XML               Minimal configura...
Scheduling                     config/torquebox.yml                     jobs:                       mail_notifier:        ...
Services               Long running services with 3 line configuration               Full access to the Rails environment ...
Services               config/torquebox.yml               services:                MessageNotifier:                  confi...
Messaging          JMS supported out-of-the-box (HornetQ)          Advanced Messaging Queuing Protocol (AMQP)          - R...
AMQPMonday 26 March 12
Messaging                In a long running service -                ...                def do_something                   ...
Backgroundable                     As easy as A, B, C ...                     class User < ActiveRecord::Base             ...
Clustering                 torquebox run --clustered                 Does everything                 Servers in a LAN are ...
Caching        TorqueBox provides an implementation of the Rails 3.x        ActiveSupport::Cache::Store that exposes your ...
PerformanceMonday 26 March 12
PerformanceMonday 26 March 12
Risks           - Version 2 is quite stable but still at RC1           - Upgrading JRuby will not help sometimes          ...
Surprise!!!Monday 26 March 12
Questions?Monday 26 March 12
Thank YouMonday 26 March 12
Upcoming SlideShare
Loading in...5
×

When Ruby Meets Java - The Power of Torquebox

7,585

Published on

Slides from @arunagw and rockyj.in 's talk from Ruby Conf India 2012.

Published in: Technology, Education
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,585
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
14
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

When Ruby Meets Java - The Power of Torquebox

  1. 1. When Ruby Meets Java T h e Powe r o f To r q u e b o xMonday 26 March 12
  2. 2. About Us A r u n A g r aw a l - 2 8 0 + c o m m i t s i n R a i l s c o re - M o n g o i d c o re t e a m m e m b e r - C re a t o r o f o m n i a u t h - t w i t t e r - C o d i n g o n R a i l s s i n c e 2 0 0 7 - a g r aw a l a r u n . c o m / @ a r u n a g w R o c k y J a i s w a l - C o d i n g s i n c e 1 9 9 5 - K n o w b i t s o f J av a & R u b y - E n j oy u s i n g J R u b y - ro c k y j . i n / @ w h a t s u p ro c k yMonday 26 March 12
  3. 3. ToDo - T h e E n t e r p r i s e - W h a t i s To r q u e b o x - D e m o - S c h e d u l i n g - S e r v i c e s - M e s s a g i n g - B a c k g ro u n d a b l e - C l u s t e r i n g & C a c h i n g - Pe r f o r m a n c e & S u m m a r y - S u r p r i s e ! !Monday 26 March 12
  4. 4. Pop Quiz Coolest Thing About JRuby(1.6) ?Monday 26 March 12
  5. 5. The EnterpriseMonday 26 March 12
  6. 6. What If... Wouldn’t it be great if - I could use the power of Java libraries with the ease of Ruby - I could use the power of a proven Java Server without writing any XML - I could deploy my JRuby app and test it without rebuilding it and restarting the serverMonday 26 March 12
  7. 7. TORQUEBOX Built upon JBoss 7 Built using JRuby (1.6.7) Supports Rack, Rails, Sinatra Everything in one boxMonday 26 March 12
  8. 8. TORQUEBOXMonday 26 March 12
  9. 9. Installation - Download the distribution from torquebox.org OR - rvm jruby (1.6.7) jruby -J-Xmx1024m -S gem install torquebox-server --preMonday 26 March 12
  10. 10. Our Sh***y AppMonday 26 March 12
  11. 11. Scheduling Uses the battle-tested Quartz Java library Zero XML Minimal configuration No manual thread / process management No messing with cronMonday 26 March 12
  12. 12. Scheduling config/torquebox.yml jobs: mail_notifier: job: MailNotifier cron: */5 * * * * ? description: Deliver reminder email class MailNotifier def run send_reminder_notification end def send_reminder_notification puts "Sending mail ..." #UserMailer.reminder_email(User.find(1)).deliver end endMonday 26 March 12
  13. 13. Services Long running services with 3 line configuration Full access to the Rails environment JVM threads!Monday 26 March 12
  14. 14. Services config/torquebox.yml services: MessageNotifier: config: name: hello class MessageNotifier def initialize(opts={}) @name = opts[name] end def start Thread.new { run } end def stop @done = true end def run until @done do_something #todo sleep(5) end end endMonday 26 March 12
  15. 15. Messaging JMS supported out-of-the-box (HornetQ) Advanced Messaging Queuing Protocol (AMQP) - RabbitMQ Supports STOMP out of the boxMonday 26 March 12
  16. 16. AMQPMonday 26 March 12
  17. 17. Messaging In a long running service - ... def do_something puts "Checking the queue for messages ..." bunny = Bunny.new(:logging => false) # start a communication session with the amqp server bunny.start # declare a queue q = bunny.queue(@name) # get message from the queue msg = q.pop[:payload] puts "This is the message: " + msg.to_s # close the connection bunny.stop endMonday 26 March 12
  18. 18. Backgroundable As easy as A, B, C ... class User < ActiveRecord::Base include TorqueBox::Messaging::Backgroundable always_background :send_signup_notification validates_confirmation_of : ... def send_signup_notification(user) UserMailer.welcome_email(user).deliver end endMonday 26 March 12
  19. 19. Clustering torquebox run --clustered Does everything Servers in a LAN are automatically clustered Top it up with mod_cluster from JBossMonday 26 March 12
  20. 20. Caching TorqueBox provides an implementation of the Rails 3.x ActiveSupport::Cache::Store that exposes your application to the Infinispan data grid. Uses Infinispan by default Can utilize the cluster with minimal config Share the cache across the cluster - FTW!Monday 26 March 12
  21. 21. PerformanceMonday 26 March 12
  22. 22. PerformanceMonday 26 March 12
  23. 23. Risks - Version 2 is quite stable but still at RC1 - Upgrading JRuby will not help sometimes - You will be on a cutting edge open-source technology but documentation is great, help is available online and on IRCMonday 26 March 12
  24. 24. Surprise!!!Monday 26 March 12
  25. 25. Questions?Monday 26 March 12
  26. 26. Thank YouMonday 26 March 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×