SlideShare a Scribd company logo
1 of 112
Download to read offline
Toby Crawley
                                          Charlotte.rb
       Creative  Commons  BY-­SA  3.0
                                            May 2011

Wednesday, May 25, 2011
whoami

                   • @tcrawley
                   • C  >  Java  >  PHP  >  Java  >  Ruby  >  
                     Java?
                   • Red  Hat  Senior  Engineer  
                   • member  of

Wednesday, May 25, 2011
Wednesday, May 25, 2011
Goal


                     To  convert  you  all  to  
                     TorqueBox  users!



Wednesday, May 25, 2011
TorqueBox
                the power of JBoss with the expressiveness of Ruby




Wednesday, May 25, 2011
TorqueBox:  what?

                   • A  “real”  Application  Server  for  Ruby
                   • 100%  open-­source,  LGPL  license
                   • Based  on  JBoss  AS  and  JRuby
                   • Recently  released  1.0.0!

Wednesday, May 25, 2011
Yes,  it's  Java




Wednesday, May 25, 2011
I  promise...

                   • No  XML  
                   • No  Java  *
                   • No  war  files  *
                   • Only  Ruby  and  YAML
                    * Unless you really want to

Wednesday, May 25, 2011
The  Competition

              Unicorn,  Thin,  Passenger,  
              Trinidad,  Warbler...

              ...all  address  only  the  web  
              question.


Wednesday, May 25, 2011
TorqueBox:  why?
                   • “Native”  support  for  Rack  apps
                   • Built-­in:  
                    • background  processing
                    • scheduling
                    • daemons  (services)
                    • clustering
                   • Easily  scalable
Wednesday, May 25, 2011
JBoss  AS
                          the good parts




Wednesday, May 25, 2011
Wednesday, May 25, 2011
AS  =  Application  Server



                   • Not  just  “web  server  +  interpreter”
                   • More  like  initd  than  httpd


Wednesday, May 25, 2011
JRuby
                          a good idea done well




Wednesday, May 25, 2011
JRuby:  why?

                   • Very  fast  runtime
                   • Real  threads
                   • Java  libraries
                   • Java  tools
                   • Healthy  community

Wednesday, May 25, 2011
Setting  Up  TorqueBox
                          in a few easy steps!




Wednesday, May 25, 2011
Easy  Install
         (download  1.0.0  from  torquebox.org)

         $  unzip  torquebox-­dist-­1.0.0-­bin.zip

         $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0
         $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss
         $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby

         $  export  PATH=$JRUBY_HOME/bin:$PATH


Wednesday, May 25, 2011
Easy  Install
         (download  1.0.0  from  torquebox.org)

         $  unzip  torquebox-­dist-­1.0.0-­bin.zip

         $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0
         $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss
         $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby

         $  export  PATH=$JRUBY_HOME/bin:$PATH


Wednesday, May 25, 2011
Easy  Install
         (download  1.0.0  from  torquebox.org)

         $  unzip  torquebox-­dist-­1.0.0-­bin.zip

         $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0
         $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss
         $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby

         $  export  PATH=$JRUBY_HOME/bin:$PATH


Wednesday, May 25, 2011
Easy  Install
         (download  1.0.0  from  torquebox.org)

         $  unzip  torquebox-­dist-­1.0.0-­bin.zip

         $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0
         $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss
         $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby

         $  export  PATH=$JRUBY_HOME/bin:$PATH


Wednesday, May 25, 2011
Easy  Install
         (download  1.0.0  from  torquebox.org)

         $  unzip  torquebox-­dist-­1.0.0.CR1-­bin.zip
                                        Make  sure  the  jruby  
                                      found  in  your  path  is  in  
         $  export  TORQUEBOX_HOME=$PWD/torquebox-­1*
                                       $JRUBY_HOME/bin.
         $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss
         $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby

         $  export  PATH=$JRUBY_HOME/bin:$PATH


Wednesday, May 25, 2011
Easy  Install
         (download  1.0.0  from  torquebox.org)

         $  unzip  torquebox-­dist-­1.0.0.CR1-­bin.zip
                                        Make  sure  the  jruby  
                                      found  in  your  path  is  in  
         $  export  TORQUEBOX_HOME=$PWD/torquebox-­1*
                                       $JRUBY_HOME/bin.
         $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss
         $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby

         $  export  PATH=$JRUBY_HOME/bin:$PATH


Wednesday, May 25, 2011
Rake  Tasks
               Rakefile




             require  "torquebox-­rake-­support"




Wednesday, May 25, 2011
Database  Connectivity
               Gemfile



             gem  "activerecord-­jdbc-­adapter"

             gem  "jdbc-­postgres"
             #  gem  "jdbc-­sqlite3"
             #  gem  "jdbc-­mysql"



Wednesday, May 25, 2011
Rails  Template

                   • Adds  TorqueBox  rake  tasks
                   • Adds  the  JDBC  sqlite3  gems
                   • Adds  TorqueBox  session_store
                   • Adds  Backgroundable  module

Wednesday, May 25, 2011
Rake  Tasks

         rake  torquebox:run
                 Run  TorqueBox  server

         rake  torquebox:deploy[context_path]
                 Deploy  the  app  in  the  current  directory

         rake  torquebox:undeploy
                 Undeploy  the  app  in  the  current  directory



Wednesday, May 25, 2011
Deployment  Descriptors


                     torquebox:deploy  creates  
                     a  deployment  descriptor  in  the  
                     $TORQUEBOX_HOME/apps/  
                     directory



Wednesday, May 25, 2011
Hot  Deployment
               $TORQUEBOX_HOME/apps/

           •      anything  added  to  apps/  
                  will  get  deployed
           •      anything  removed  from  
                  apps/  will  get  undeployed
           •      anything  updated  in  apps/  
                  will  get  redeployed
           •      TorqueBox  deployers  
                  make  JBoss  grok  YAML  
                  and  ruby  archives



Wednesday, May 25, 2011
Hot  Deployment
               $TORQUEBOX_HOME/apps/
               deployment  
                descriptors
           •      anything  added  to  apps/  
                  will  get  deployed
           •      anything  removed  from  
                  apps/  will  get  undeployed
           •      anything  updated  in  apps/  
                  will  get  redeployed
           •      TorqueBox  deployers  
                  make  JBoss  grok  YAML  
                  and  ruby  archives



Wednesday, May 25, 2011
Hot  Deployment
               $TORQUEBOX_HOME/apps/
               deployment  
                descriptors
           •      anything  added  to  apps/  
                  will  get  deployed
           •      anything  removed  from  
                  apps/  will  get  undeployed
           •      anything  updated  in  apps/  
                  will  get  redeployed
           •      TorqueBox  deployers  
                  make  JBoss  grok  YAML  
                  and  ruby  archives



Wednesday, May 25, 2011
Hot  Deployment
               $TORQUEBOX_HOME/apps/

           •      anything  added  to  apps/  
                  will  get  deployed
           •      anything  removed  from  
                  apps/  will  get  undeployed
          knob  files  (zip  
          • anything  updated  in  apps/  
            archives)
            will  get  redeployed
           •      TorqueBox  deployers  
                  make  JBoss  grok  YAML  
                  and  ruby  archives



Wednesday, May 25, 2011
Hot  Deployment
               $TORQUEBOX_HOME/apps/

           •      anything  added  to  apps/  
                  will  get  deployed
           •      anything  removed  from  
                  apps/  will  get  undeployed
          knob  files  (zip  
          • anything  updated  in  apps/  
            archives)
            will  get  redeployed
           •      TorqueBox  deployers  
                  make  JBoss  grok  YAML  
                  and  ruby  archives



Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp
               env:     development
             web:
               context: myapp
               host:    www.yourhost.com
               static: public
             environment:
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp
               env:     development
             web:                      The  fully-­qualified  
               context: myapp
               host:    www.yourhost.com
                                         path  to  the  app.    
               static: public         This  will  be  the  value  
             environment:                    of  either  
                                        RAILS_ROOT  or  
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com RACK_ROOT

Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp
               env:     development
             web:                      The  fully-­qualified  
               context: myapp
               host:    www.yourhost.com
                                         path  to  the  app.    
               static: public         This  will  be  the  value  
             environment:                    of  either  
                                        RAILS_ROOT  or  
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com RACK_ROOT

Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp
               env:     development
             web:
               context: myapp         The  runtime  mode  of  
               host:    www.yourhost.com
               static: public
                                       the  app.    This  will  be  
             environment:               either  RAILS_ENV  
                                          or  RACK_ENV
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp
               env:     development
             web:
               context: myapp         The  runtime  mode  of  
               host:    www.yourhost.com
               static: public
                                       the  app.    This  will  be  
             environment:               either  RAILS_ENV  
                                          or  RACK_ENV
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
                                   The  app’s  context  path  
              apps/myapp-­knob.yml (or  “sub  URI”):
                              http://localhost:8080/myapp
             application:            Can  be  set  via  rake:
               root:         rake  torquebox:deploy[myapp]
                        /path/to/myapp
               env:     development The  default  is  root:
             web:               http://localhost:8080/
               context: myapp
               host:    www.yourhost.com
               static: public
             environment:
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
                                   The  app’s  context  path  
              apps/myapp-­knob.yml (or  “sub  URI”):
                              http://localhost:8080/myapp
             application:            Can  be  set  via  rake:
               root:         rake  torquebox:deploy[myapp]
                        /path/to/myapp
               env:     development The  default  is  root:
             web:               http://localhost:8080/
               context: myapp
               host:    www.yourhost.com
               static: public
             environment:
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
                                          A  list  of  virtual  
               root:    /path/to/myapp
               env:     development
                                       hostnames  to  which  
             web:                        to  bind  the  app.
               context: myapp
               host:    www.yourhost.com
               static: public
             environment:
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
                                          A  list  of  virtual  
               root:    /path/to/myapp
               env:     development
                                       hostnames  to  which  
             web:                        to  bind  the  app.
               context: myapp
               host:    www.yourhost.com
               static: public
             environment:
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp
               env:     development      The  location  of  the  
             web:                             app’s  static  
               context: myapp              content,  either  
               host:    www.yourhost.com
                                         absolute  or  relative  
               static: public
             environment:                 to  the  app’s  root.
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp
               env:     development      The  location  of  the  
             web:                             app’s  static  
               context: myapp              content,  either  
               host:    www.yourhost.com
                                         absolute  or  relative  
               static: public
             environment:                 to  the  app’s  root.
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp Any  environment  
               env:     development
             web:                     variables  required  
               context: myapp            by  the  app.
               host:    www.yourhost.com
               static: public
             environment:
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors
               apps/myapp-­knob.yml

             application:
               root:    /path/to/myapp Any  environment  
               env:     development
             web:                     variables  required  
               context: myapp            by  the  app.
               host:    www.yourhost.com
               static: public
             environment:
               MAIL_HOST: mail.yourhost.com
               REPLY_TO: you@yourhost.com


Wednesday, May 25, 2011
Deployment  Descriptors

                   •      config/torquebox.yml  
                   •      internal  descriptors  have  the  
                          same  structure  as  the  
                          external  ones  in  apps/
                   •      may  be  used  to  provide  your  
                          own  reasonable  defaults


Wednesday, May 25, 2011
Components
               Put 'em together, and you have an AS




Wednesday, May 25, 2011
Web
                          make rack, not war




Wednesday, May 25, 2011
Web

                   • All  rack-­based  frameworks  
                     supported:  rails,  sinatra,  etc
                   • No  packaging  required:  apps  deploy  
                     from  where  they  sit  on  disk
                   • No  redeploy  necessary  to  see  
                     changes  when  using  rack  reloading  
                          or  rails  development  mode


Wednesday, May 25, 2011
Scheduling
                          get regular later




Wednesday, May 25, 2011
Jobs
               app/jobs/newsletter_sender.rb

             class  NewsletterSender
               
                 def  run()
                     subscriptions  =  Subscription.find(:all)
                     subscriptions.each  do  |e|
                         send_newsletter(  e  )
                     end
                 end
               
             end



Wednesday, May 25, 2011
Jobs
               config/torquebox.yml

             jobs:
                 monthly_newsletter:
                     description:  first  of  month
                     job:  NewsletterSender
                     cron:  ‘0  0  0  1  *  ?’
                 
                 process_tps_reports:
                     job:  TPSReportProcessor
                     cron:  ‘0  0  0  0  MON  ?’

Wednesday, May 25, 2011
Jobs
                   • More  portable.  What  is  the  first  day  
                     of  the  week  on  BSD  again?    What’s  
                          cron  on  Windows?
                   •      Self  contained  within  the  app.    No  
                          external  systems  to  manage  and  
                          keep  in  sync.
                   •      Full  application  environment  loaded  
                          and  available.


Wednesday, May 25, 2011
Messaging
                           asynchronicity




Wednesday, May 25, 2011
Background  Processing



                   • Tasks
                   • Backgroundable  methods


Wednesday, May 25, 2011
Tasks
               app/tasks/email_task.rb

             class  EmailTask  <  TorqueBox::Messaging::Task
                 def  welcome(payload)
                     person  =  Person.find_by_id(payload[:id])
                     person.send_welcome_spam  if  person
                 end
             end




Wednesday, May 25, 2011
Tasks
               app/tasks/email_task.rb

             class  EmailTask  <  TorqueBox::Messaging::Task
                 def  welcome(payload)
                     person  =  Person.find_by_id(payload[:id])
                     person.send_welcome_spam  if  person
                 end
             end




Wednesday, May 25, 2011
Tasks
               app/tasks/email_task.rb

             class  EmailTask  <  TorqueBox::Messaging::Task
                 def  welcome(payload)
                     person  =  Person.find_by_id(payload[:id])
                     person.send_welcome_spam  if  person
                 end
             end




Wednesday, May 25, 2011
Tasks
               app/tasks/email_task.rb

             class  EmailTask  <  TorqueBox::Messaging::Task
                 def  welcome(payload)
                     person  =  Person.find_by_id(payload[:id])
                     person.send_welcome_spam  if  person
                 end
             end




Wednesday, May 25, 2011
Tasks
               app/controllers/people_controller.rb


             class  PeopleController  <  ApplicationController
                 def  create
                     @person  =  Person.new(params[:person])
                     respond_to  do  |format|
                         if  @person.save
                             EmailTask.async(:welcome,  :id  =>  person.id)
                             #  respond  appropriately
                         end
                     end
                 end
             end




Wednesday, May 25, 2011
Tasks
               app/controllers/people_controller.rb


             class  PeopleController  <  ApplicationController
                 def  create
                     @person  =  Person.new(params[:person])
                     respond_to  do  |format|
                         if  @person.save
                             EmailTask.async(:welcome,  :id  =>  person.id)
                             #  respond  appropriately
                         end
                     end
                 end
             end




Wednesday, May 25, 2011
Backgroundable

                     Inspired  by  DelayedJob’s  
                     handle_asynchronously,  
                     it’s  trivial  to  create  implicit  
                     background  Tasks.


Wednesday, May 25, 2011
Backgroundable
               lib/something.rb

             include  TorqueBox::Messaging  

             class  Something
                 include  Backgroundable
                 always_background  :foo
                 def  foo;;  end
                 def  bar;;  end
             end
             ...
             @something.foo
             @something.background.bar


Wednesday, May 25, 2011
Backgroundable
               lib/something.rb

             include  TorqueBox::Messaging  

             class  Something
                 include  Backgroundable
                 always_background  :foo
                 def  foo;;  end
                 def  bar;;  end
             end
             ...
             @something.foo
             @something.background.bar


Wednesday, May 25, 2011
Backgroundable
               lib/something.rb

             include  TorqueBox::Messaging  

             class  Something
                 include  Backgroundable
                 always_background  :foo
                 def  foo;;  end
                 def  bar;;  end
             end
             ...
             @something.foo
             @something.background.bar


Wednesday, May 25, 2011
Backgroundable
               lib/something.rb

             include  TorqueBox::Messaging  

             class  Something
                 include  Backgroundable
                 always_background  :foo
                 def  foo;;  end
                 def  bar;;  end
             end
             ...
             @something.foo
             @something.background.bar


Wednesday, May 25, 2011
Background  Processing

                     Call  it  from  your  
                     controllers,  models,  and  
                     observers,  or  even  other  
                     tasks.  Even  in  non-­Rails  
                     apps!


Wednesday, May 25, 2011
Background  Processing
                   • No  extra  tables  in  your  database
                   • No  external  system  to  manage
                   • Little  to  no  config  required  at  all
                   • System  gets  redeployed  w/app
                   • Efficient  loading  of  rails  environment
                   • Automatic  load  balancing  and  retries
                   • Works  on  Windows,  if  you  care
Wednesday, May 25, 2011
TorqueBox::Messaging


                   • JMS  (Java  Message  Service)  
                     is  an  API  for  messaging
                   • implementation
                     HornetQ  is  the  JBoss  JMS  




Wednesday, May 25, 2011
Queues
                     Tasks  and  Backgroundable  are  
                     built  on  top  of  Queues.    Of  
                     course,  you  may  build  your  
                     own  messaging  based  apps  by  
                     defining  your  own  Queues,  
                     Topics,  and  their  message  
                     Processors  yourself.

Wednesday, May 25, 2011
Queues
               config/torquebox.yml

             queues:
                 /queues/questions:

                 /queues/answers:
                     durable:  false


Wednesday, May 25, 2011
Topics

                   • behavior  is  different,  but  interface  is  
                     the  same.
                   • all  subscribers  of  a  topic  see  each  
                     message,  but  only  one  subscriber  
                          will  see  any  message  from  a  queue  
                   •      use  topics:  section  of  
                          torquebox.yml  to  define  topics


Wednesday, May 25, 2011
Processors

                     You  can  create  a  processor  
                     class  to  receive  messages  
                     from  a  Topic  or  Queue



Wednesday, May 25, 2011
Processors
               app/models/print_handler.rb

             include  TorqueBox::Messaging

             class  PrintHandler  <  MessageProcessor
                 def  initialize(opts)
                     @printer  =  opts['printer']  ||  default
                 end
                 def  on_message(body)
                     puts  "Processing  #{body}  of  #{message}"
                 end
             end



Wednesday, May 25, 2011
Processors
               config/torquebox.yml

             messaging:
               /topics/orders:
                 - PrintHandler
                 - ShoutHandler
               /queues/receipts:
                 PrintHandler:
                   concurrency: 5
                   config:
                     printer: the_little_one


Wednesday, May 25, 2011
Processors
               config/torquebox.yml

             messaging:
               /topics/orders:
                 - PrintHandler
                 - ShoutHandler
               /queues/receipts:
                 PrintHandler:
                   concurrency: 5
                   config:
                     printer: the_little_one


Wednesday, May 25, 2011
Processors
               config/torquebox.yml

             messaging:
               /topics/orders:
                 - PrintHandler
                 - ShoutHandler
               /queues/receipts:
                 PrintHandler:
                   concurrency: 5
                   config:
                     printer: the_little_one


Wednesday, May 25, 2011
Processors
               config/torquebox.yml

             messaging:
               /topics/orders:
                 - PrintHandler
                 - ShoutHandler
               /queues/receipts:
                 PrintHandler:
                   concurrency: 5
                   config:
                     printer: the_little_one


Wednesday, May 25, 2011
Processors
               app/models/print_handler.rb

             include  TorqueBox::Messaging

             class  PrintHandler  <  MessageProcessor
                 def  initialize(opts)
                     @printer  =  opts['printer']  ||  default
                 end
                 def  on_message(body)
                     puts  "Processing  #{body}  of  #{message}"
                 end
             end



Wednesday, May 25, 2011
Queues  (again)


                     But  how  do  you  send  a  
                     message?



Wednesday, May 25, 2011
Queues
               contrived  example

             questions  =  Queue.new('/queues/questions')
             answers  =  Queue.new('/queues/answers')
               
             Thread.new  do
                 questions.publish  "What  time  is  it?"
                 puts  answers.receive(  :timeout  =>  1000  )
             end
               
             puts  questions.receive
             answers.publish  Time.now



Wednesday, May 25, 2011
Queues
               contrived  example

             questions  =  Queue.new('/queues/questions')
             answers  =  Queue.new('/queues/answers')
               
             Thread.new  do
                 questions.publish  "What  time  is  it?"
                 puts  answers.receive(  :timeout  =>  1000  )
             end
               
             puts  questions.receive
             answers.publish  Time.now



Wednesday, May 25, 2011
Queues
               contrived  example

             questions  =  Queue.new('/queues/questions')
             answers  =  Queue.new('/queues/answers')
               
             Thread.new  do
                 questions.publish  "What  time  is  it?"
                 puts  answers.receive(  :timeout  =>  1000  )
             end
               
             puts  questions.receive
             answers.publish  Time.now



Wednesday, May 25, 2011
Queues
               contrived  example

             questions  =  Queue.new('/queues/questions')
             answers  =  Queue.new('/queues/answers')
               
             Thread.new  do
                 questions.publish  "What  time  is  it?"
                 puts  answers.receive(  :timeout  =>  1000  )
             end
               
             puts  questions.receive
             answers.publish  Time.now



Wednesday, May 25, 2011
Services
                          run along, lil’ daemon




Wednesday, May 25, 2011
Services

                     Long-­running,  non-­web  
                     “daemons”  that  share  the  
                     runtime  environment  and  
                     deployment  lifecycle  of  
                     your  app.


Wednesday, May 25, 2011
Services
                   • Represented  as  a  class  with  
                     optional  initialize(Hash),  
                          start()  and  stop()  methods,  
                          which  should  each  return  quickly.
                   •      Typically  will  start  a  long-­running  
                          loop  in  a  thread  and  respond  to  
                          external  events.
                   •      Configured  via  services:  section  in  
                          torquebox.yml

Wednesday, May 25, 2011
Services
               config/torquebox.yml


             services:
                 TimeMachine:
                     queue:  /queue/morris_day

                 MyMudServer:

                 SomeOtherService:



Wednesday, May 25, 2011
Services
               app/services/time_machine.rb

             class  TimeMachine
                 def  initialize(opts)
                     @queue  =  Queue.new(opts['queue'])
                 end

                 def  start  
                     Thread.new  do
                           until  @done
                               @queue.publish(Time.now)
                               sleep(1)  
                           end
                       end
                 end

                 def  stop;;  @done  =  true;;  end
             end




Wednesday, May 25, 2011
Services
               app/services/time_machine.rb

             class  TimeMachine
                 def  initialize(opts)
                     @queue  =  Queue.new(opts['queue'])
                 end

                 def  start  
                     Thread.new  do
                           until  @done
                               @queue.publish(Time.now)
                               sleep(1)  
                           end
                       end
                 end

                 def  stop;;  @done  =  true;;  end
             end




Wednesday, May 25, 2011
Services
               app/services/time_machine.rb

             class  TimeMachine
                 def  initialize(opts)
                     @queue  =  Queue.new(opts['queue'])
                 end

                 def  start  
                     Thread.new  do
                           until  @done
                               @queue.publish(Time.now)
                               sleep(1)  
                           end
                       end
                 end

                 def  stop;;  @done  =  true;;  end
             end




Wednesday, May 25, 2011
Services
               app/services/time_machine.rb

             class  TimeMachine
                 def  initialize(opts)
                     @queue  =  Queue.new(opts['queue'])
                 end

                 def  start  
                     Thread.new  do
                           until  @done
                               @queue.publish(Time.now)
                               sleep(1)  
                           end
                       end
                 end

                 def  stop;;  @done  =  true;;  end
             end




Wednesday, May 25, 2011
Caching
                          save a little for later




Wednesday, May 25, 2011
Caching
               config/application.rb


             config.cache_store  =  
             :torque_box_store,  :mode  =>  :local

             #  or

             config.cache_store  =  
             ActiveSupport::Cache::TorqueBoxStore.new
             (  :mode  =>  :local  )



Wednesday, May 25, 2011
Runtime  Options
                             shorts or sweats?




Wednesday, May 25, 2011
Runtime  Options
               config/torquebox.yml


             #per  app!
             ruby:
                 version:  1.9  
                 compile_mode:  jit




Wednesday, May 25, 2011
Clustering
                          less failure faster




Wednesday, May 25, 2011
Web

                   • session  replication
                   • intelligent  load-­balancing  (via  
                     mod_cluster)
                   • failover  (via  mod_cluster)

Wednesday, May 25, 2011
Messaging

                     HornetQ  clusters  
                     automatically,  giving  you  
                     message  processing  
                     capability  that  grows  with  
                     the  cluster.


Wednesday, May 25, 2011
Services

                     A  service  runs  on  every  
                     cluster  node,  unless  
                     marked  as  a  singleton.



Wednesday, May 25, 2011
Jobs

                     A  job  runs  on  every  cluster  
                     node,  unless  marked  as  a  
                     singleton  (just  like  
                     services).


Wednesday, May 25, 2011
Caching

                     Infinispan  clusters  
                     automatically,  "distributing"  
                     your  cache.  



Wednesday, May 25, 2011
Other  Cool  Stuff



Wednesday, May 25, 2011
BackStage

              Dashboard  to  inspect  and  
              control  Ruby  components.

              And  a  RESTful  API.


Wednesday, May 25, 2011
Wednesday, May 25, 2011
StompBox


              Easy  Heroku-­esque  
              git-­based  deployments.



Wednesday, May 25, 2011
StompBox




Wednesday, May 25, 2011
Live  Demo
                           wish me luck




Wednesday, May 25, 2011
Wednesday, May 25, 2011
Roadmap

              Soon  -­  2.0  (AS7)
              Then...
                    Authentication
                  Mobicents
                  ???  -­  you  tell  us


Wednesday, May 25, 2011
Resources

                   • http://torquebox.org
                   • irc:  #torquebox  on  freenode
                   • https://github.com/torquebox
                   • http://twitter.com/torquebox

Wednesday, May 25, 2011
Thanks!
                          questions?




Wednesday, May 25, 2011

More Related Content

What's hot

Introducing Immutant
Introducing Immutant Introducing Immutant
Introducing Immutant Jim Crossley
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on InfinispanLance Ball
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxClaus Ibsen
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Puppet
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Puppet
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsPablo Godel
 
Apache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentationApache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentationClaus Ibsen
 
UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011tobiascrawley
 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A RideBruce Snyder
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelClaus Ibsen
 
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Puppet
 
Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet
 
Introductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with TerraformIntroductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with TerraformMichael Heyns
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionJoshua Thijssen
 
Apache Jackrabbit Oak - Scale your content repository to the cloud
Apache Jackrabbit Oak - Scale your content repository to the cloudApache Jackrabbit Oak - Scale your content repository to the cloud
Apache Jackrabbit Oak - Scale your content repository to the cloudRobert Munteanu
 
Java EE Servlet JSP Tutorial- Cookbook 1
Java EE Servlet JSP Tutorial- Cookbook 1Java EE Servlet JSP Tutorial- Cookbook 1
Java EE Servlet JSP Tutorial- Cookbook 1billdigman
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration libraryClaus Ibsen
 
Apache Sling - The whys and the hows
Apache Sling - The whys and the howsApache Sling - The whys and the hows
Apache Sling - The whys and the howsRobert Munteanu
 
Django Deployment with Fabric
Django Deployment with FabricDjango Deployment with Fabric
Django Deployment with FabricJonas Nockert
 

What's hot (20)

Introducing Immutant
Introducing Immutant Introducing Immutant
Introducing Immutant
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the box
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
Perl in Teh Cloud
Perl in Teh CloudPerl in Teh Cloud
Perl in Teh Cloud
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
 
Apache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentationApache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentation
 
UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011
 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
 
Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worlds
 
Introductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with TerraformIntroductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with Terraform
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 
Apache Jackrabbit Oak - Scale your content repository to the cloud
Apache Jackrabbit Oak - Scale your content repository to the cloudApache Jackrabbit Oak - Scale your content repository to the cloud
Apache Jackrabbit Oak - Scale your content repository to the cloud
 
Java EE Servlet JSP Tutorial- Cookbook 1
Java EE Servlet JSP Tutorial- Cookbook 1Java EE Servlet JSP Tutorial- Cookbook 1
Java EE Servlet JSP Tutorial- Cookbook 1
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration library
 
Apache Sling - The whys and the hows
Apache Sling - The whys and the howsApache Sling - The whys and the hows
Apache Sling - The whys and the hows
 
Django Deployment with Fabric
Django Deployment with FabricDjango Deployment with Fabric
Django Deployment with Fabric
 

Similar to Torquebox @ Charlotte.rb May 2011

Oscon2011 tutorial
Oscon2011 tutorialOscon2011 tutorial
Oscon2011 tutorialjtimberman
 
Ruby para-programadores-php
Ruby para-programadores-phpRuby para-programadores-php
Ruby para-programadores-phpJuan Maiz
 
every-day-automation
every-day-automationevery-day-automation
every-day-automationAmir Barylko
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forwardeug3n_cojocaru
 
Seattle OpenStack Meetup
Seattle OpenStack MeetupSeattle OpenStack Meetup
Seattle OpenStack MeetupMatt Ray
 
Java to Scala: Why & How
Java to Scala: Why & HowJava to Scala: Why & How
Java to Scala: Why & HowGraham Tackley
 
Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)ecommerce poland expo
 
Nosql from java developer pov
Nosql from java developer povNosql from java developer pov
Nosql from java developer povRoman Pichlík
 
Apache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEEApache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEEJacek Laskowski
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJAX London
 

Similar to Torquebox @ Charlotte.rb May 2011 (20)

Oscon2011 tutorial
Oscon2011 tutorialOscon2011 tutorial
Oscon2011 tutorial
 
Splash
SplashSplash
Splash
 
Ruby para-programadores-php
Ruby para-programadores-phpRuby para-programadores-php
Ruby para-programadores-php
 
every-day-automation
every-day-automationevery-day-automation
every-day-automation
 
RunDeck
RunDeckRunDeck
RunDeck
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forward
 
Seattle OpenStack Meetup
Seattle OpenStack MeetupSeattle OpenStack Meetup
Seattle OpenStack Meetup
 
Java to Scala: Why & How
Java to Scala: Why & HowJava to Scala: Why & How
Java to Scala: Why & How
 
JRubyConf 2009
JRubyConf 2009JRubyConf 2009
JRubyConf 2009
 
Paul Querna - libcloud
Paul Querna - libcloudPaul Querna - libcloud
Paul Querna - libcloud
 
Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)
 
Homebrew atlrug
Homebrew atlrugHomebrew atlrug
Homebrew atlrug
 
Stackato v4
Stackato v4Stackato v4
Stackato v4
 
Nosql from java developer pov
Nosql from java developer povNosql from java developer pov
Nosql from java developer pov
 
Apache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEEApache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEE
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
 
Caridy patino - node-js
Caridy patino - node-jsCaridy patino - node-js
Caridy patino - node-js
 

Recently uploaded

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Torquebox @ Charlotte.rb May 2011

  • 1. Toby Crawley Charlotte.rb Creative  Commons  BY-­SA  3.0 May 2011 Wednesday, May 25, 2011
  • 2. whoami • @tcrawley • C  >  Java  >  PHP  >  Java  >  Ruby  >   Java? • Red  Hat  Senior  Engineer   • member  of Wednesday, May 25, 2011
  • 4. Goal To  convert  you  all  to   TorqueBox  users! Wednesday, May 25, 2011
  • 5. TorqueBox the power of JBoss with the expressiveness of Ruby Wednesday, May 25, 2011
  • 6. TorqueBox:  what? • A  “real”  Application  Server  for  Ruby • 100%  open-­source,  LGPL  license • Based  on  JBoss  AS  and  JRuby • Recently  released  1.0.0! Wednesday, May 25, 2011
  • 8. I  promise... • No  XML   • No  Java  * • No  war  files  * • Only  Ruby  and  YAML * Unless you really want to Wednesday, May 25, 2011
  • 9. The  Competition Unicorn,  Thin,  Passenger,   Trinidad,  Warbler... ...all  address  only  the  web   question. Wednesday, May 25, 2011
  • 10. TorqueBox:  why? • “Native”  support  for  Rack  apps • Built-­in:   • background  processing • scheduling • daemons  (services) • clustering • Easily  scalable Wednesday, May 25, 2011
  • 11. JBoss  AS the good parts Wednesday, May 25, 2011
  • 13. AS  =  Application  Server • Not  just  “web  server  +  interpreter” • More  like  initd  than  httpd Wednesday, May 25, 2011
  • 14. JRuby a good idea done well Wednesday, May 25, 2011
  • 15. JRuby:  why? • Very  fast  runtime • Real  threads • Java  libraries • Java  tools • Healthy  community Wednesday, May 25, 2011
  • 16. Setting  Up  TorqueBox in a few easy steps! Wednesday, May 25, 2011
  • 17. Easy  Install (download  1.0.0  from  torquebox.org) $  unzip  torquebox-­dist-­1.0.0-­bin.zip $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0 $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby $  export  PATH=$JRUBY_HOME/bin:$PATH Wednesday, May 25, 2011
  • 18. Easy  Install (download  1.0.0  from  torquebox.org) $  unzip  torquebox-­dist-­1.0.0-­bin.zip $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0 $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby $  export  PATH=$JRUBY_HOME/bin:$PATH Wednesday, May 25, 2011
  • 19. Easy  Install (download  1.0.0  from  torquebox.org) $  unzip  torquebox-­dist-­1.0.0-­bin.zip $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0 $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby $  export  PATH=$JRUBY_HOME/bin:$PATH Wednesday, May 25, 2011
  • 20. Easy  Install (download  1.0.0  from  torquebox.org) $  unzip  torquebox-­dist-­1.0.0-­bin.zip $  export  TORQUEBOX_HOME=$PWD/torquebox-­1.0.0 $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby $  export  PATH=$JRUBY_HOME/bin:$PATH Wednesday, May 25, 2011
  • 21. Easy  Install (download  1.0.0  from  torquebox.org) $  unzip  torquebox-­dist-­1.0.0.CR1-­bin.zip Make  sure  the  jruby   found  in  your  path  is  in   $  export  TORQUEBOX_HOME=$PWD/torquebox-­1* $JRUBY_HOME/bin. $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby $  export  PATH=$JRUBY_HOME/bin:$PATH Wednesday, May 25, 2011
  • 22. Easy  Install (download  1.0.0  from  torquebox.org) $  unzip  torquebox-­dist-­1.0.0.CR1-­bin.zip Make  sure  the  jruby   found  in  your  path  is  in   $  export  TORQUEBOX_HOME=$PWD/torquebox-­1* $JRUBY_HOME/bin. $  export  JBOSS_HOME=$TORQUEBOX_HOME/jboss $  export  JRUBY_HOME=$TORQUEBOX_HOME/jruby $  export  PATH=$JRUBY_HOME/bin:$PATH Wednesday, May 25, 2011
  • 23. Rake  Tasks Rakefile require  "torquebox-­rake-­support" Wednesday, May 25, 2011
  • 24. Database  Connectivity Gemfile gem  "activerecord-­jdbc-­adapter" gem  "jdbc-­postgres" #  gem  "jdbc-­sqlite3" #  gem  "jdbc-­mysql" Wednesday, May 25, 2011
  • 25. Rails  Template • Adds  TorqueBox  rake  tasks • Adds  the  JDBC  sqlite3  gems • Adds  TorqueBox  session_store • Adds  Backgroundable  module Wednesday, May 25, 2011
  • 26. Rake  Tasks rake  torquebox:run        Run  TorqueBox  server rake  torquebox:deploy[context_path]        Deploy  the  app  in  the  current  directory rake  torquebox:undeploy        Undeploy  the  app  in  the  current  directory Wednesday, May 25, 2011
  • 27. Deployment  Descriptors torquebox:deploy  creates   a  deployment  descriptor  in  the   $TORQUEBOX_HOME/apps/   directory Wednesday, May 25, 2011
  • 28. Hot  Deployment $TORQUEBOX_HOME/apps/ • anything  added  to  apps/   will  get  deployed • anything  removed  from   apps/  will  get  undeployed • anything  updated  in  apps/   will  get  redeployed • TorqueBox  deployers   make  JBoss  grok  YAML   and  ruby  archives Wednesday, May 25, 2011
  • 29. Hot  Deployment $TORQUEBOX_HOME/apps/ deployment   descriptors • anything  added  to  apps/   will  get  deployed • anything  removed  from   apps/  will  get  undeployed • anything  updated  in  apps/   will  get  redeployed • TorqueBox  deployers   make  JBoss  grok  YAML   and  ruby  archives Wednesday, May 25, 2011
  • 30. Hot  Deployment $TORQUEBOX_HOME/apps/ deployment   descriptors • anything  added  to  apps/   will  get  deployed • anything  removed  from   apps/  will  get  undeployed • anything  updated  in  apps/   will  get  redeployed • TorqueBox  deployers   make  JBoss  grok  YAML   and  ruby  archives Wednesday, May 25, 2011
  • 31. Hot  Deployment $TORQUEBOX_HOME/apps/ • anything  added  to  apps/   will  get  deployed • anything  removed  from   apps/  will  get  undeployed knob  files  (zip   • anything  updated  in  apps/   archives) will  get  redeployed • TorqueBox  deployers   make  JBoss  grok  YAML   and  ruby  archives Wednesday, May 25, 2011
  • 32. Hot  Deployment $TORQUEBOX_HOME/apps/ • anything  added  to  apps/   will  get  deployed • anything  removed  from   apps/  will  get  undeployed knob  files  (zip   • anything  updated  in  apps/   archives) will  get  redeployed • TorqueBox  deployers   make  JBoss  grok  YAML   and  ruby  archives Wednesday, May 25, 2011
  • 33. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp env: development web: context: myapp host: www.yourhost.com static: public environment: MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 34. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp env: development web: The  fully-­qualified   context: myapp host: www.yourhost.com path  to  the  app.     static: public This  will  be  the  value   environment: of  either   RAILS_ROOT  or   MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com RACK_ROOT Wednesday, May 25, 2011
  • 35. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp env: development web: The  fully-­qualified   context: myapp host: www.yourhost.com path  to  the  app.     static: public This  will  be  the  value   environment: of  either   RAILS_ROOT  or   MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com RACK_ROOT Wednesday, May 25, 2011
  • 36. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp env: development web: context: myapp The  runtime  mode  of   host: www.yourhost.com static: public the  app.    This  will  be   environment: either  RAILS_ENV   or  RACK_ENV MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 37. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp env: development web: context: myapp The  runtime  mode  of   host: www.yourhost.com static: public the  app.    This  will  be   environment: either  RAILS_ENV   or  RACK_ENV MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 38. Deployment  Descriptors The  app’s  context  path   apps/myapp-­knob.yml (or  “sub  URI”): http://localhost:8080/myapp application: Can  be  set  via  rake: root: rake  torquebox:deploy[myapp] /path/to/myapp env: development The  default  is  root: web: http://localhost:8080/ context: myapp host: www.yourhost.com static: public environment: MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 39. Deployment  Descriptors The  app’s  context  path   apps/myapp-­knob.yml (or  “sub  URI”): http://localhost:8080/myapp application: Can  be  set  via  rake: root: rake  torquebox:deploy[myapp] /path/to/myapp env: development The  default  is  root: web: http://localhost:8080/ context: myapp host: www.yourhost.com static: public environment: MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 40. Deployment  Descriptors apps/myapp-­knob.yml application: A  list  of  virtual   root: /path/to/myapp env: development hostnames  to  which   web: to  bind  the  app. context: myapp host: www.yourhost.com static: public environment: MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 41. Deployment  Descriptors apps/myapp-­knob.yml application: A  list  of  virtual   root: /path/to/myapp env: development hostnames  to  which   web: to  bind  the  app. context: myapp host: www.yourhost.com static: public environment: MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 42. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp env: development The  location  of  the   web: app’s  static   context: myapp content,  either   host: www.yourhost.com absolute  or  relative   static: public environment: to  the  app’s  root. MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 43. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp env: development The  location  of  the   web: app’s  static   context: myapp content,  either   host: www.yourhost.com absolute  or  relative   static: public environment: to  the  app’s  root. MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 44. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp Any  environment   env: development web: variables  required   context: myapp by  the  app. host: www.yourhost.com static: public environment: MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 45. Deployment  Descriptors apps/myapp-­knob.yml application: root: /path/to/myapp Any  environment   env: development web: variables  required   context: myapp by  the  app. host: www.yourhost.com static: public environment: MAIL_HOST: mail.yourhost.com REPLY_TO: you@yourhost.com Wednesday, May 25, 2011
  • 46. Deployment  Descriptors • config/torquebox.yml   • internal  descriptors  have  the   same  structure  as  the   external  ones  in  apps/ • may  be  used  to  provide  your   own  reasonable  defaults Wednesday, May 25, 2011
  • 47. Components Put 'em together, and you have an AS Wednesday, May 25, 2011
  • 48. Web make rack, not war Wednesday, May 25, 2011
  • 49. Web • All  rack-­based  frameworks   supported:  rails,  sinatra,  etc • No  packaging  required:  apps  deploy   from  where  they  sit  on  disk • No  redeploy  necessary  to  see   changes  when  using  rack  reloading   or  rails  development  mode Wednesday, May 25, 2011
  • 50. Scheduling get regular later Wednesday, May 25, 2011
  • 51. Jobs app/jobs/newsletter_sender.rb class  NewsletterSender      def  run()        subscriptions  =  Subscription.find(:all)        subscriptions.each  do  |e|            send_newsletter(  e  )        end    end   end Wednesday, May 25, 2011
  • 52. Jobs config/torquebox.yml jobs:    monthly_newsletter:        description:  first  of  month        job:  NewsletterSender        cron:  ‘0  0  0  1  *  ?’        process_tps_reports:        job:  TPSReportProcessor        cron:  ‘0  0  0  0  MON  ?’ Wednesday, May 25, 2011
  • 53. Jobs • More  portable.  What  is  the  first  day   of  the  week  on  BSD  again?    What’s   cron  on  Windows? • Self  contained  within  the  app.    No   external  systems  to  manage  and   keep  in  sync. • Full  application  environment  loaded   and  available. Wednesday, May 25, 2011
  • 54. Messaging asynchronicity Wednesday, May 25, 2011
  • 55. Background  Processing • Tasks • Backgroundable  methods Wednesday, May 25, 2011
  • 56. Tasks app/tasks/email_task.rb class  EmailTask  <  TorqueBox::Messaging::Task    def  welcome(payload)        person  =  Person.find_by_id(payload[:id])        person.send_welcome_spam  if  person    end end Wednesday, May 25, 2011
  • 57. Tasks app/tasks/email_task.rb class  EmailTask  <  TorqueBox::Messaging::Task    def  welcome(payload)        person  =  Person.find_by_id(payload[:id])        person.send_welcome_spam  if  person    end end Wednesday, May 25, 2011
  • 58. Tasks app/tasks/email_task.rb class  EmailTask  <  TorqueBox::Messaging::Task    def  welcome(payload)        person  =  Person.find_by_id(payload[:id])        person.send_welcome_spam  if  person    end end Wednesday, May 25, 2011
  • 59. Tasks app/tasks/email_task.rb class  EmailTask  <  TorqueBox::Messaging::Task    def  welcome(payload)        person  =  Person.find_by_id(payload[:id])        person.send_welcome_spam  if  person    end end Wednesday, May 25, 2011
  • 60. Tasks app/controllers/people_controller.rb class  PeopleController  <  ApplicationController    def  create        @person  =  Person.new(params[:person])        respond_to  do  |format|            if  @person.save                EmailTask.async(:welcome,  :id  =>  person.id)                #  respond  appropriately            end        end    end end Wednesday, May 25, 2011
  • 61. Tasks app/controllers/people_controller.rb class  PeopleController  <  ApplicationController    def  create        @person  =  Person.new(params[:person])        respond_to  do  |format|            if  @person.save                EmailTask.async(:welcome,  :id  =>  person.id)                #  respond  appropriately            end        end    end end Wednesday, May 25, 2011
  • 62. Backgroundable Inspired  by  DelayedJob’s   handle_asynchronously,   it’s  trivial  to  create  implicit   background  Tasks. Wednesday, May 25, 2011
  • 63. Backgroundable lib/something.rb include  TorqueBox::Messaging   class  Something    include  Backgroundable    always_background  :foo    def  foo;;  end    def  bar;;  end end ... @something.foo @something.background.bar Wednesday, May 25, 2011
  • 64. Backgroundable lib/something.rb include  TorqueBox::Messaging   class  Something    include  Backgroundable    always_background  :foo    def  foo;;  end    def  bar;;  end end ... @something.foo @something.background.bar Wednesday, May 25, 2011
  • 65. Backgroundable lib/something.rb include  TorqueBox::Messaging   class  Something    include  Backgroundable    always_background  :foo    def  foo;;  end    def  bar;;  end end ... @something.foo @something.background.bar Wednesday, May 25, 2011
  • 66. Backgroundable lib/something.rb include  TorqueBox::Messaging   class  Something    include  Backgroundable    always_background  :foo    def  foo;;  end    def  bar;;  end end ... @something.foo @something.background.bar Wednesday, May 25, 2011
  • 67. Background  Processing Call  it  from  your   controllers,  models,  and   observers,  or  even  other   tasks.  Even  in  non-­Rails   apps! Wednesday, May 25, 2011
  • 68. Background  Processing • No  extra  tables  in  your  database • No  external  system  to  manage • Little  to  no  config  required  at  all • System  gets  redeployed  w/app • Efficient  loading  of  rails  environment • Automatic  load  balancing  and  retries • Works  on  Windows,  if  you  care Wednesday, May 25, 2011
  • 69. TorqueBox::Messaging • JMS  (Java  Message  Service)   is  an  API  for  messaging • implementation HornetQ  is  the  JBoss  JMS   Wednesday, May 25, 2011
  • 70. Queues Tasks  and  Backgroundable  are   built  on  top  of  Queues.    Of   course,  you  may  build  your   own  messaging  based  apps  by   defining  your  own  Queues,   Topics,  and  their  message   Processors  yourself. Wednesday, May 25, 2011
  • 71. Queues config/torquebox.yml queues:    /queues/questions:    /queues/answers:        durable:  false Wednesday, May 25, 2011
  • 72. Topics • behavior  is  different,  but  interface  is   the  same. • all  subscribers  of  a  topic  see  each   message,  but  only  one  subscriber   will  see  any  message  from  a  queue   • use  topics:  section  of   torquebox.yml  to  define  topics Wednesday, May 25, 2011
  • 73. Processors You  can  create  a  processor   class  to  receive  messages   from  a  Topic  or  Queue Wednesday, May 25, 2011
  • 74. Processors app/models/print_handler.rb include  TorqueBox::Messaging class  PrintHandler  <  MessageProcessor    def  initialize(opts)        @printer  =  opts['printer']  ||  default    end    def  on_message(body)        puts  "Processing  #{body}  of  #{message}"    end end Wednesday, May 25, 2011
  • 75. Processors config/torquebox.yml messaging: /topics/orders: - PrintHandler - ShoutHandler /queues/receipts: PrintHandler: concurrency: 5 config: printer: the_little_one Wednesday, May 25, 2011
  • 76. Processors config/torquebox.yml messaging: /topics/orders: - PrintHandler - ShoutHandler /queues/receipts: PrintHandler: concurrency: 5 config: printer: the_little_one Wednesday, May 25, 2011
  • 77. Processors config/torquebox.yml messaging: /topics/orders: - PrintHandler - ShoutHandler /queues/receipts: PrintHandler: concurrency: 5 config: printer: the_little_one Wednesday, May 25, 2011
  • 78. Processors config/torquebox.yml messaging: /topics/orders: - PrintHandler - ShoutHandler /queues/receipts: PrintHandler: concurrency: 5 config: printer: the_little_one Wednesday, May 25, 2011
  • 79. Processors app/models/print_handler.rb include  TorqueBox::Messaging class  PrintHandler  <  MessageProcessor    def  initialize(opts)        @printer  =  opts['printer']  ||  default    end    def  on_message(body)        puts  "Processing  #{body}  of  #{message}"    end end Wednesday, May 25, 2011
  • 80. Queues  (again) But  how  do  you  send  a   message? Wednesday, May 25, 2011
  • 81. Queues contrived  example questions  =  Queue.new('/queues/questions') answers  =  Queue.new('/queues/answers')   Thread.new  do    questions.publish  "What  time  is  it?"    puts  answers.receive(  :timeout  =>  1000  ) end   puts  questions.receive answers.publish  Time.now Wednesday, May 25, 2011
  • 82. Queues contrived  example questions  =  Queue.new('/queues/questions') answers  =  Queue.new('/queues/answers')   Thread.new  do    questions.publish  "What  time  is  it?"    puts  answers.receive(  :timeout  =>  1000  ) end   puts  questions.receive answers.publish  Time.now Wednesday, May 25, 2011
  • 83. Queues contrived  example questions  =  Queue.new('/queues/questions') answers  =  Queue.new('/queues/answers')   Thread.new  do    questions.publish  "What  time  is  it?"    puts  answers.receive(  :timeout  =>  1000  ) end   puts  questions.receive answers.publish  Time.now Wednesday, May 25, 2011
  • 84. Queues contrived  example questions  =  Queue.new('/queues/questions') answers  =  Queue.new('/queues/answers')   Thread.new  do    questions.publish  "What  time  is  it?"    puts  answers.receive(  :timeout  =>  1000  ) end   puts  questions.receive answers.publish  Time.now Wednesday, May 25, 2011
  • 85. Services run along, lil’ daemon Wednesday, May 25, 2011
  • 86. Services Long-­running,  non-­web   “daemons”  that  share  the   runtime  environment  and   deployment  lifecycle  of   your  app. Wednesday, May 25, 2011
  • 87. Services • Represented  as  a  class  with   optional  initialize(Hash),   start()  and  stop()  methods,   which  should  each  return  quickly. • Typically  will  start  a  long-­running   loop  in  a  thread  and  respond  to   external  events. • Configured  via  services:  section  in   torquebox.yml Wednesday, May 25, 2011
  • 88. Services config/torquebox.yml services:    TimeMachine:        queue:  /queue/morris_day    MyMudServer:    SomeOtherService: Wednesday, May 25, 2011
  • 89. Services app/services/time_machine.rb class  TimeMachine    def  initialize(opts)        @queue  =  Queue.new(opts['queue'])    end    def  start          Thread.new  do              until  @done                  @queue.publish(Time.now)                  sleep(1)                end          end    end    def  stop;;  @done  =  true;;  end end Wednesday, May 25, 2011
  • 90. Services app/services/time_machine.rb class  TimeMachine    def  initialize(opts)        @queue  =  Queue.new(opts['queue'])    end    def  start          Thread.new  do              until  @done                  @queue.publish(Time.now)                  sleep(1)                end          end    end    def  stop;;  @done  =  true;;  end end Wednesday, May 25, 2011
  • 91. Services app/services/time_machine.rb class  TimeMachine    def  initialize(opts)        @queue  =  Queue.new(opts['queue'])    end    def  start          Thread.new  do              until  @done                  @queue.publish(Time.now)                  sleep(1)                end          end    end    def  stop;;  @done  =  true;;  end end Wednesday, May 25, 2011
  • 92. Services app/services/time_machine.rb class  TimeMachine    def  initialize(opts)        @queue  =  Queue.new(opts['queue'])    end    def  start          Thread.new  do              until  @done                  @queue.publish(Time.now)                  sleep(1)                end          end    end    def  stop;;  @done  =  true;;  end end Wednesday, May 25, 2011
  • 93. Caching save a little for later Wednesday, May 25, 2011
  • 94. Caching config/application.rb config.cache_store  =   :torque_box_store,  :mode  =>  :local #  or config.cache_store  =   ActiveSupport::Cache::TorqueBoxStore.new (  :mode  =>  :local  ) Wednesday, May 25, 2011
  • 95. Runtime  Options shorts or sweats? Wednesday, May 25, 2011
  • 96. Runtime  Options config/torquebox.yml #per  app! ruby:    version:  1.9      compile_mode:  jit Wednesday, May 25, 2011
  • 97. Clustering less failure faster Wednesday, May 25, 2011
  • 98. Web • session  replication • intelligent  load-­balancing  (via   mod_cluster) • failover  (via  mod_cluster) Wednesday, May 25, 2011
  • 99. Messaging HornetQ  clusters   automatically,  giving  you   message  processing   capability  that  grows  with   the  cluster. Wednesday, May 25, 2011
  • 100. Services A  service  runs  on  every   cluster  node,  unless   marked  as  a  singleton. Wednesday, May 25, 2011
  • 101. Jobs A  job  runs  on  every  cluster   node,  unless  marked  as  a   singleton  (just  like   services). Wednesday, May 25, 2011
  • 102. Caching Infinispan  clusters   automatically,  "distributing"   your  cache.   Wednesday, May 25, 2011
  • 104. BackStage Dashboard  to  inspect  and   control  Ruby  components. And  a  RESTful  API. Wednesday, May 25, 2011
  • 106. StompBox Easy  Heroku-­esque   git-­based  deployments. Wednesday, May 25, 2011
  • 108. Live  Demo wish me luck Wednesday, May 25, 2011
  • 110. Roadmap Soon  -­  2.0  (AS7) Then...      Authentication    Mobicents    ???  -­  you  tell  us Wednesday, May 25, 2011
  • 111. Resources • http://torquebox.org • irc:  #torquebox  on  freenode • https://github.com/torquebox • http://twitter.com/torquebox Wednesday, May 25, 2011
  • 112. Thanks! questions? Wednesday, May 25, 2011