SlideShare una empresa de Scribd logo
1 de 80
Descargar para leer sin conexión
Jim Crossley
                                        jcrossley@redhat.com
       Creative  Commons  BY-­SA  3.0




Monday, March 19, 2012
Agenda

                    •    Who,  what,  WHY?
                    •    A  fake,  real-­life  application
                    •    How?
                    •    API  deep-­dive
                    •    Clustering,  etc




Monday, March 19, 2012
Who?

                    • Jim  Crossley  -­  @jcrossley3
                    • Toby  Crawley  -­  @tcrawley


                    • Bob  McWhirter  -­  Director  of  Polyglot
                    • JBoss  by  Red  Hat



Monday, March 19, 2012
What?

                    •    An  app  server  for  Clojure
                    •    Inspired  by  TorqueBox
                    •    Powered  by  JBoss  AS7
                    •    Started  in  September  2011




Monday, March 19, 2012
App  Server?


                    • Multiple  apps  running  in  same  JVM
                    • Isolation  via  classloaders
                    • Shared  common  services




Monday, March 19, 2012
Inspired  by  TorqueBox

                    • Make  Ring,  not  War
                    • Clojure  interfaces  to  JBoss  
                      middleware
                    • No  XML
                    • Adapt  AS7  to  the  Clojure  
                      development  common  practices



Monday, March 19, 2012
AS7  is  teh  awesome!
                    •    Tomcat  for  web
                    •    HornetQ  for  messaging
                    •    Infinispan  for  caching
                    •    Quartz  for  scheduling
                    •    Distributed  Transactions  (XA)
                    •    Clustering
                    •    Management/Monitoring  


Monday, March 19, 2012
Certified,  fwiw




                         Java  EE  6  Full  Profile

Monday, March 19, 2012
Why?
                    • Reduce  incidental  complexity
                    • Simplify  deployment  of  non-­trivial  
                      applications
                    • Simplify  clustering  to  achieve  high-­
                      availability
                    • Encapsulate  JBoss  services
                    • Exploit  the  JVM



Monday, March 19, 2012
Polyglot

                    • Leverage  the  best  tool  on  a  single  
                      platform,  regardless  of  language
                    • “ruby  in  the  front,  java  in  the  middle,  
                      clojure  in  the  rear”
                    • Red  Hat  is  committed  to  it




Monday, March 19, 2012
Maybe  a  fit?

                    • If  you’re  already  using  Jetty,  
                      Memcached,  RabbitMQ,  and/or  Cron
                    • If  you  have  a  polyglot  organization,  
                      especially  Ruby  and  Java
                    • If  you  must  integrate  with  legacy  
                      Java  EE



Monday, March 19, 2012
Let’s  Get  Real
                         CRUD  can  only  take  you  so  far




Monday, March 19, 2012
Apps  often  require...

                    • More  than  one  web  interface,  e.g.  
                      administration
                    • Background  processing
                    • Periodic  maintenance
                    • Dynamic  data  sources,  e.g.  REST
                    • Services



Monday, March 19, 2012
But...


                    We’d  still  like  to  treat  the  
                    integration  of  those  components  
                    as  a  single,  versioned  application.




Monday, March 19, 2012
Consider...

                    • A  tweet-­analysis  app
                    • Filters  the  Twitter  streaming  API  for  
                      brand  keywords
                    • Scrapes  URL’s  from  the  tweets
                    • Stores  weighted  results  of  sentiment  
                      analysis



Monday, March 19, 2012
Possible  Components...

                    •    A  web  app  for  displaying  impressions
                    •    An  admin  app  for  defining  users
                    •    The  Twitter  streaming  client
                    •    The  URL  scraper
                    •    A  housekeeper  to  purge  old  data




Monday, March 19, 2012
The  Web  Apps


                  ;;;;  Mount  the  ring  handlers
                  (web/start  “/”  brandy.web/app)
                  (web/start  “/admin”  brandy.web/admin)




Monday, March 19, 2012
The  Message  Queue

                  ;;;;  Where  scrapers  pick  up  their  work
                  (msg/start  “/queue/tweets”)

                  ;;;;  The  scrapers
                  (msg/listen  “/queue/tweets”  
                                          brandy.msg/scrape)




Monday, March 19, 2012
The  Twitter  Service


                  ;;;;  The  work  producer
                  (daemon/start  “streamer”  
                                              brandy.stream/start  
                                              brandy.stream/stop)




Monday, March 19, 2012
The  Recurring  Job


                  ;;;;  The  housekeeper
                  (job/schedule  “housekeeper”  
                                              “0  0  0  *  *  ?”
                                              brandy.job/purge)




Monday, March 19, 2012
immutant.clj
                  ;;  The  ring  handlers
                  (web/start  “/”            brandy.web/app)
                  (web/start  “/admin”  brandy.web/admin)

                  ;;  Where  scrapers  pick  up  their  work
                  (msg/start  “/queue/tweets”)

                  ;;  The  scrapers
                  (msg/listen  “/queue/tweets”  brandy.msg/scrape)

                  ;;  The  work  producer
                  (daemon/start  “streamer”  brandy.stream/start  
                                                                    brandy.stream/stop)
                  ;;  The  housekeeper
                  (job/schedule  “housekeeper”  “0  0  0  *  *  ?”
                                                                          brandy.job/purge)



Monday, March 19, 2012
immutant.clj
                  ;;  The  ring  handlers
                  (web/start  “/”            brandy.web/app)
                  (web/start  “/admin”  brandy.web/admin)

                  ;;  Where  scrapers  pick  up  their  work
                  (msg/start  “/queue/tweets”)

                  ;;  The  scrapers
                  (msg/listen  “/queue/tweets”  brandy.msg/scrape)

                  ;;  The  work  producer
                  (daemon/start  “streamer”  brandy.stream/start  
                                                                    brandy.stream/stop)
                  ;;  The  housekeeper
                  (job/schedule  “housekeeper”  “0  0  0  *  *  ?”
                                                                          brandy.job/purge)



Monday, March 19, 2012
immutant.clj
                  ;;  The  ring  handlers
                  (web/start  “/”            brandy.web/app)
                  (web/start  “/admin”  brandy.web/admin)

                  ;;  Where  scrapers  pick  up  their  work
                  (msg/start  “/queue/tweets”)

                  ;;  The  scrapers
                  (msg/listen  “/queue/tweets”  brandy.msg/scrape)

                  ;;  The  work  producer
                  (daemon/start  “streamer”  brandy.stream/start  
                                                                    brandy.stream/stop)
                  ;;  The  housekeeper
                  (job/schedule  “housekeeper”  “0  0  0  *  *  ?”
                                                                          brandy.job/purge)



Monday, March 19, 2012
Immutant
                           how?




Monday, March 19, 2012
Leiningen  Plugin




                  $  lein  plugin  install  lein-­immutant  0.6.0




Monday, March 19, 2012
Install



                  $  lein  immutant  install  [version]




Monday, March 19, 2012
Install


                    By  default,  the  plugin  installs  
                    Immutant  beneath  

                          ~/.lein/immutant/



Monday, March 19, 2012
Run



                  $  lein  immutant  run




Monday, March 19, 2012
Deploy

                  $  lein  new  myapp
                  $  cd  myapp

                  $  lein  immutant  init
                  $  $EDITOR  immutant.clj

                  $  lein  immutant  deploy




Monday, March 19, 2012
Deploy

                    A  “deployment  descriptor”  is  a  
                    glorified  symlink  written  to  
                    jboss/standalone/deployments


                    Its  contents:
                    {:root  "/the/path/to/your/app"}



Monday, March 19, 2012
Deploy

                    Each  app  gets  a  dedicated  
                    Clojure  runtime  and  classpath  
                    containing  resolved  
                    dependencies,  src,  lib,  and  
                    resources.


Monday, March 19, 2012
project.clj

                  (defproject  myapp  "1.2.3"
                      ...

                      :immutant  {:init  myapp.core/initialize
                                            :resolve-­dependencies  true
                                            :context-­path  "/"
                                            :swank-­port  4111
                                            :nrepl-­port  4112})




Monday, March 19, 2012
Overlay


                  $  lein  immutant  overlay  torquebox

                  $  export  TORQUEBOX_HOME=$IMMUTANT_HOME




Monday, March 19, 2012
The  API
                         immutant  namespaces




Monday, March 19, 2012
The  API
                    • Dynamic  by  design
                      • No  static  xml  files  or  annotations
                    • Modules
                      • Web
                      • Messaging
                      • Caching  
                      • Scheduling
                      • Daemons


Monday, March 19, 2012
immutant.web
                              ring




Monday, March 19, 2012
Web

                    • Supports  any  Ring-­based  handler
                    • Ring  middleware  to  expose  the  
                      Servlet  session
                    • Multiple  web  apps  may  share  the  
                      same  lifecycle  via  “subcontexts”




Monday, March 19, 2012
Web

                  (require  ‘[immutant.web  :as  web])

                  (defn  my-­handler  [request]
                      {:status  200
                        :headers  {"Content-­Type"  "text/html"}
                        :body  "Hello  from  Immutant!"})

                  (web/start  "/hi"  my-­handler)




Monday, March 19, 2012
Context  paths
                  project.clj

                  (defproject  myapp  "1.2.3"  ...)

                  immutant.clj

                  (web/start  "/"  main)
                  ;;;;  http://localhost:8080/myapp/

                  (web/start  "/admin"  admin)
                  ;;;;  http://localhost:8080/myapp/admin




Monday, March 19, 2012
Context  paths
                  project.clj

                  (defproject  myapp  "1.2.3”
                      :immutant  {:context-­path  "/"})

                  immutant.clj

                  (web/start  "/"  main)
                  ;;;;  http://localhost:8080/

                  (web/start  "/admin"  admin)
                  ;;;;  http://localhost:8080/admin



Monday, March 19, 2012
Session  Replication

                  (require  ‘[immutant.web  :as  web]
                                    ‘[immutant.web.session  :as  iws])

                  (web/start  "/"
                      (ring-­session/wrap-­session
                          handler
                          {:store  (iws/servlet-­store)}))




Monday, March 19, 2012
immutant.messaging
                                hornetq




Monday, March 19, 2012
Messaging
               publish-­subscribe




               point-­to-­point




Monday, March 19, 2012
Messaging


                  (require  ‘[immutant.messaging  :as  msg])

                  (msg/start  "/queue/work")
                  (msg/start  "/topic/news")




Monday, March 19, 2012
Producers


                  ;;;;  Content  may  be  any  serializable
                  ;;;;  data  structure

                  (msg/publish  “/queue/work”  anything)




Monday, March 19, 2012
Producers


                  ;;;;  May  be  as  complex  as  necessary

                  (msg/publish  "/queue/work"  
                      {:a  "b"  :c  [1  2  3  {:foo  42}]})




Monday, March 19, 2012
Producers

                  ;;;;  Support  priority  and  time-­to-­live

                  (msg/publish  “/queue/work”  
                                            a-­message  
                                            :priority  :high
                                            :ttl  1000)




Monday, March 19, 2012
Producers

                  ;;;;  Three  message  encodings:
                  ;;;;  :clojure  :json  :text

                  (msg/publish  "/queue/work"  
                      {:a  "b"  :c  [1  2  3  {:foo  42}]}
                      :encoding  :json)




Monday, March 19, 2012
Messaging

                    With  TorqueBox,  messages  
                    comprised  of  standard  collections  
                    and  types  are  transparently  
                    interoperable  between  Clojure  
                    and  Ruby  in  either  direction.


Monday, March 19, 2012
Consumers


                  ;;;;  Block  until  message  arrives

                  (let  [task  (msg/receive  "/queue/work")]
                      (perform  task))




Monday, March 19, 2012
Consumers


                  ;;;;  Create  a  lazy  sequence  of  messages

                  (take  4  (msg/message-­seq  “/queue/foo”))




Monday, March 19, 2012
Consumers

                  (defn  upper-­caser  [s]
                      (msg/publish  "/topic/upper"
                                                (.toUpperCase  s)))

                  ;;;;  Register  a  listener
                  (msg/listen  "/queue/lower"  upper-­caser)




Monday, March 19, 2012
Messaging



                    Automatic  retries,  failover  and  
                    load-­balancing  when  clustered.




Monday, March 19, 2012
immutant.cache
                             infinispan




Monday, March 19, 2012
Distributed  Cache

                    • Backed  by  Infinispan  data  grid
                    • Implements  core  Clojure  interfaces
                    •core.cache/CacheProtocol
                    • core.memoize  store




Monday, March 19, 2012
Infinispan

                    •    Eviction:  FIFO,  LRU
                    •    Expiration:  time-­to-­live,  idle  time
                    •    Persistence:  write-­through/behind
                    •    Transactional:  JTA/XA
                    •    MVCC-­based  concurrency
                    •    Flexible  clustering



Monday, March 19, 2012
Cache  Modes

                    • :local  -­  non-­clustered
                    • Clustered
                      • :invalidated  -­  no  data  shared
                      • :replicated  -­  all  data  shared
                      • :distributed  -­  linear  scalability




Monday, March 19, 2012
:invalidated




Monday, March 19, 2012
:replicated




Monday, March 19, 2012
:distributed




Monday, March 19, 2012
immutant.cache

                    • All  caches  have  a  name  and  a  mode  
                      (:local,  :invalidated,  :replicated,  
                      :distributed)
                    • Like-­named  Immutant  caches  are  
                      backed  by  the  same  Infinispan  cache




Monday, March 19, 2012
immutant.cache


                  (require  ‘[immutant.cache  :as  ic])

                  (def  a  (ic/cache  “foo”  :replicated))
                  (def  b  (ic/cache  “bar”))
                  (def  c  (ic/cache  “foo”))




Monday, March 19, 2012
immutant.cache

                  (def  c  (ic/cache  “foo”))
                  (assoc  c  :a  1)
                  (merge  c  {:b  2  :c  3})
                  (dissoc  c  :c)

                  c  =>  {:a  1,  :b  2}




Monday, March 19, 2012
Memoization

                  (require  ‘[immutant.cache  :as  ic])

                  (def  memoized-­fn  (ic/memo  slow-­fn  “foo”))
                  (memoized-­fn  1  2  3)
                  (def  c  (ic/cache  “foo”))

                  c  =>  {[1  2  3]  42}




Monday, March 19, 2012
Explicit  writes
                  (require  ‘[immutant.cache  :as  ic])

                  (def  opts  {:ttl  2  :idle  1  :units  :days})
                  (def  c  (ic/cache  “foo”))

                  (ic/put  c  key  value  opts)
                  (ic/put-­if-­absent  c  key  value  opts)
                  (ic/put-­if-­present  c  key  value  opts)
                  (ic/put-­if-­replace  c  key  old  new  opts)
                  (ic/delete  c  key)




Monday, March 19, 2012
immutant.jobs
                              quartz




Monday, March 19, 2012
Scheduling

                  (require  ‘[immutant.jobs  :as  job])

                  ;;;;  Once  a  month
                  (job/schedule  "newsletter"
                                              "0  0  0  1  *  ?"
                                              news/monthly
                                              :singleton  true)




Monday, March 19, 2012
Scheduling
                  “Fire  every  half  hour  from  10am  until  1pm  on  
                          the  third  Friday  of  each  month”

                         0   */30 10-13      ?      *      FRI#3

                Seconds Minutes     Hours   DOM    Month   DOW     Year

                                                            1-7
                                                   1-12            1970-
                                            1-31           SUN-
                    0-59     0-59   0-23           JAN-            2099
                                            ?LW            SAT
                                                   DEC             empty
                                                           ?L#



Monday, March 19, 2012
Scheduling

                  (require  ‘[immutant.jobs  :as  job])

                  (job/at  “name”  “3m”  
                      #(println  “I  fire  after  3  minutes”))

                  (job/every  “name”  “1d”
                      #(println  “I  fire  once  a  day”))




Monday, March 19, 2012
immutant.daemons
                            long-­running  services




Monday, March 19, 2012
Daemons


                  (require  ‘[immutant.daemons  :as  daemon])

                  (daemon/start  "name"  start-­fn  stop-­fn)




Monday, March 19, 2012
Daemons
                  (def  response  (atom  nil))

                  (defn  start  []
                      (reset!  response
                          (twitter-­statuses-­filter  
                              (terms)
                              url-­scraper)))

                  (defn  stop  []  
                      ((:cancel  (meta  @response))))

                  (daemon/start  "tweets"  start  stop  
                                              :singleton  true)



Monday, March 19, 2012
Clustering
                         simple  horizontal  scaling




Monday, March 19, 2012
Clustering



                  $  lein  immutant  run  -­-­clustered




Monday, March 19, 2012
Clustering

                    • Session  replication
                    • Robust,  load-­balanced  message  
                      distribution
                    • HA  Singleton
                    • HA  Jobs
                    • Infinispan



Monday, March 19, 2012
mod_cluster

                    • An  Apache  module  aware  of  JBoss
                    • Reverse  proxy  via  AJP  or  HTTP[S]
                    • Uses  load  statistics  and  deployment  
                      availability  for  intelligent  routing
                    • Optional  session  affinity
                    • Failover



Monday, March 19, 2012
mod_cluster




Monday, March 19, 2012
Coming  soon

                    •    Distributed  Transactions  (XA)
                    •    OpenShift  integration
                    •    Websockets
                    •    Better  remote  support
                    •    Domain  Mode  (cluster  management)




Monday, March 19, 2012
http://immutant.org
                              #immutant  
                            @immutants




Monday, March 19, 2012
Introducing Immutant

Más contenido relacionado

La actualidad más candente

Merb The Super Bike Of Frameworks
Merb The Super Bike Of FrameworksMerb The Super Bike Of Frameworks
Merb The Super Bike Of FrameworksRowan Hick
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Arun Gupta
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)Stoyan Zhekov
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on InfinispanLance Ball
 
Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2billdigman
 
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
 
Enterprise Maven Repository BOF
Enterprise Maven Repository BOFEnterprise Maven Repository BOF
Enterprise Maven Repository BOFMax Andersen
 
MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and ProfitJoshua Ballanco
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Shaer Hassan
 
What is Rack Hijacking API
What is Rack Hijacking APIWhat is Rack Hijacking API
What is Rack Hijacking APINomo Kiyoshi
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsersjeresig
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring RailsJonathan Weiss
 
A web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentationA web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentationJustin Dorfman
 
Resin Outperforms NginX
Resin Outperforms NginXResin Outperforms NginX
Resin Outperforms NginXbilldigman
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011tobiascrawley
 

La actualidad más candente (20)

Merb The Super Bike Of Frameworks
Merb The Super Bike Of FrameworksMerb The Super Bike Of Frameworks
Merb The Super Bike Of Frameworks
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)
 
Scaling Django
Scaling DjangoScaling Django
Scaling Django
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
 
JRuby and You
JRuby and YouJRuby and You
JRuby and You
 
Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2
 
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
 
Enterprise Maven Repository BOF
Enterprise Maven Repository BOFEnterprise Maven Repository BOF
Enterprise Maven Repository BOF
 
MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and Profit
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09
 
What is Rack Hijacking API
What is Rack Hijacking APIWhat is Rack Hijacking API
What is Rack Hijacking API
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsers
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring Rails
 
A web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentationA web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentation
 
How Flipkart scales PHP
How Flipkart scales PHPHow Flipkart scales PHP
How Flipkart scales PHP
 
Resin Outperforms NginX
Resin Outperforms NginXResin Outperforms NginX
Resin Outperforms NginX
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011
 

Similar a Introducing Immutant

Front end performance improvements
Front end performance improvementsFront end performance improvements
Front end performance improvementsMatthew Farina
 
Dan node meetup_socket_talk
Dan node meetup_socket_talkDan node meetup_socket_talk
Dan node meetup_socket_talkIshi von Meier
 
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Fabrice Bernhard
 
BP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoBP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoSerdar Basegmez
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.jsRichard Rodger
 
Frontend Engineer Toolbox
Frontend Engineer ToolboxFrontend Engineer Toolbox
Frontend Engineer ToolboxYnon Perek
 
GitHub Notable OSS Project
GitHub  Notable OSS ProjectGitHub  Notable OSS Project
GitHub Notable OSS Projectroumia
 
Riding The N Train: How we dismantled Groupon's Ruby on Rails Monolith
Riding The N Train: How we dismantled Groupon's Ruby on Rails MonolithRiding The N Train: How we dismantled Groupon's Ruby on Rails Monolith
Riding The N Train: How we dismantled Groupon's Ruby on Rails MonolithSean McCullough
 
Django Bootstrapping with Ease
Django Bootstrapping with EaseDjango Bootstrapping with Ease
Django Bootstrapping with EaseConcentric Sky
 
Ruby CI with Jenkins
Ruby CI with JenkinsRuby CI with Jenkins
Ruby CI with Jenkinscowboyd
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for EngineersBrian LeRoux
 
IBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksIBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksDejan Glozic
 
Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015Christian Heilmann
 
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios
 
Hyves: Mobile app development with HTML5 and Javascript
Hyves: Mobile app development with HTML5 and JavascriptHyves: Mobile app development with HTML5 and Javascript
Hyves: Mobile app development with HTML5 and Javascriptnlwebperf
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPagesTeamstudio
 
For a Social Local and Mobile Drupal
For a Social Local and Mobile DrupalFor a Social Local and Mobile Drupal
For a Social Local and Mobile DrupalAdyax
 
Empowering the Social Web with Apache Shindig
Empowering the Social Web with Apache ShindigEmpowering the Social Web with Apache Shindig
Empowering the Social Web with Apache Shindigplindner
 

Similar a Introducing Immutant (20)

Front end performance improvements
Front end performance improvementsFront end performance improvements
Front end performance improvements
 
Dan node meetup_socket_talk
Dan node meetup_socket_talkDan node meetup_socket_talk
Dan node meetup_socket_talk
 
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
 
BP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoBP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM Domino
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.js
 
Frontend Engineer Toolbox
Frontend Engineer ToolboxFrontend Engineer Toolbox
Frontend Engineer Toolbox
 
GitHub Notable OSS Project
GitHub  Notable OSS ProjectGitHub  Notable OSS Project
GitHub Notable OSS Project
 
Riding The N Train: How we dismantled Groupon's Ruby on Rails Monolith
Riding The N Train: How we dismantled Groupon's Ruby on Rails MonolithRiding The N Train: How we dismantled Groupon's Ruby on Rails Monolith
Riding The N Train: How we dismantled Groupon's Ruby on Rails Monolith
 
Django Bootstrapping with Ease
Django Bootstrapping with EaseDjango Bootstrapping with Ease
Django Bootstrapping with Ease
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Ruby CI with Jenkins
Ruby CI with JenkinsRuby CI with Jenkins
Ruby CI with Jenkins
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
 
IBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksIBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New Tricks
 
MongoLA - Cloud Foundry
MongoLA - Cloud FoundryMongoLA - Cloud Foundry
MongoLA - Cloud Foundry
 
Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015
 
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
 
Hyves: Mobile app development with HTML5 and Javascript
Hyves: Mobile app development with HTML5 and JavascriptHyves: Mobile app development with HTML5 and Javascript
Hyves: Mobile app development with HTML5 and Javascript
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPages
 
For a Social Local and Mobile Drupal
For a Social Local and Mobile DrupalFor a Social Local and Mobile Drupal
For a Social Local and Mobile Drupal
 
Empowering the Social Web with Apache Shindig
Empowering the Social Web with Apache ShindigEmpowering the Social Web with Apache Shindig
Empowering the Social Web with Apache Shindig
 

Último

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
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
 

Último (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
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
 

Introducing Immutant

  • 1. Jim Crossley jcrossley@redhat.com Creative  Commons  BY-­SA  3.0 Monday, March 19, 2012
  • 2. Agenda • Who,  what,  WHY? • A  fake,  real-­life  application • How? • API  deep-­dive • Clustering,  etc Monday, March 19, 2012
  • 3. Who? • Jim  Crossley  -­  @jcrossley3 • Toby  Crawley  -­  @tcrawley • Bob  McWhirter  -­  Director  of  Polyglot • JBoss  by  Red  Hat Monday, March 19, 2012
  • 4. What? • An  app  server  for  Clojure • Inspired  by  TorqueBox • Powered  by  JBoss  AS7 • Started  in  September  2011 Monday, March 19, 2012
  • 5. App  Server? • Multiple  apps  running  in  same  JVM • Isolation  via  classloaders • Shared  common  services Monday, March 19, 2012
  • 6. Inspired  by  TorqueBox • Make  Ring,  not  War • Clojure  interfaces  to  JBoss   middleware • No  XML • Adapt  AS7  to  the  Clojure   development  common  practices Monday, March 19, 2012
  • 7. AS7  is  teh  awesome! • Tomcat  for  web • HornetQ  for  messaging • Infinispan  for  caching • Quartz  for  scheduling • Distributed  Transactions  (XA) • Clustering • Management/Monitoring   Monday, March 19, 2012
  • 8. Certified,  fwiw Java  EE  6  Full  Profile Monday, March 19, 2012
  • 9. Why? • Reduce  incidental  complexity • Simplify  deployment  of  non-­trivial   applications • Simplify  clustering  to  achieve  high-­ availability • Encapsulate  JBoss  services • Exploit  the  JVM Monday, March 19, 2012
  • 10. Polyglot • Leverage  the  best  tool  on  a  single   platform,  regardless  of  language • “ruby  in  the  front,  java  in  the  middle,   clojure  in  the  rear” • Red  Hat  is  committed  to  it Monday, March 19, 2012
  • 11. Maybe  a  fit? • If  you’re  already  using  Jetty,   Memcached,  RabbitMQ,  and/or  Cron • If  you  have  a  polyglot  organization,   especially  Ruby  and  Java • If  you  must  integrate  with  legacy   Java  EE Monday, March 19, 2012
  • 12. Let’s  Get  Real CRUD  can  only  take  you  so  far Monday, March 19, 2012
  • 13. Apps  often  require... • More  than  one  web  interface,  e.g.   administration • Background  processing • Periodic  maintenance • Dynamic  data  sources,  e.g.  REST • Services Monday, March 19, 2012
  • 14. But... We’d  still  like  to  treat  the   integration  of  those  components   as  a  single,  versioned  application. Monday, March 19, 2012
  • 15. Consider... • A  tweet-­analysis  app • Filters  the  Twitter  streaming  API  for   brand  keywords • Scrapes  URL’s  from  the  tweets • Stores  weighted  results  of  sentiment   analysis Monday, March 19, 2012
  • 16. Possible  Components... • A  web  app  for  displaying  impressions • An  admin  app  for  defining  users • The  Twitter  streaming  client • The  URL  scraper • A  housekeeper  to  purge  old  data Monday, March 19, 2012
  • 17. The  Web  Apps ;;;;  Mount  the  ring  handlers (web/start  “/”  brandy.web/app) (web/start  “/admin”  brandy.web/admin) Monday, March 19, 2012
  • 18. The  Message  Queue ;;;;  Where  scrapers  pick  up  their  work (msg/start  “/queue/tweets”) ;;;;  The  scrapers (msg/listen  “/queue/tweets”                          brandy.msg/scrape) Monday, March 19, 2012
  • 19. The  Twitter  Service ;;;;  The  work  producer (daemon/start  “streamer”                              brandy.stream/start                              brandy.stream/stop) Monday, March 19, 2012
  • 20. The  Recurring  Job ;;;;  The  housekeeper (job/schedule  “housekeeper”                              “0  0  0  *  *  ?”                            brandy.job/purge) Monday, March 19, 2012
  • 21. immutant.clj ;;  The  ring  handlers (web/start  “/”            brandy.web/app) (web/start  “/admin”  brandy.web/admin) ;;  Where  scrapers  pick  up  their  work (msg/start  “/queue/tweets”) ;;  The  scrapers (msg/listen  “/queue/tweets”  brandy.msg/scrape) ;;  The  work  producer (daemon/start  “streamer”  brandy.stream/start                                                    brandy.stream/stop) ;;  The  housekeeper (job/schedule  “housekeeper”  “0  0  0  *  *  ?”                                                        brandy.job/purge) Monday, March 19, 2012
  • 22. immutant.clj ;;  The  ring  handlers (web/start  “/”            brandy.web/app) (web/start  “/admin”  brandy.web/admin) ;;  Where  scrapers  pick  up  their  work (msg/start  “/queue/tweets”) ;;  The  scrapers (msg/listen  “/queue/tweets”  brandy.msg/scrape) ;;  The  work  producer (daemon/start  “streamer”  brandy.stream/start                                                    brandy.stream/stop) ;;  The  housekeeper (job/schedule  “housekeeper”  “0  0  0  *  *  ?”                                                        brandy.job/purge) Monday, March 19, 2012
  • 23. immutant.clj ;;  The  ring  handlers (web/start  “/”            brandy.web/app) (web/start  “/admin”  brandy.web/admin) ;;  Where  scrapers  pick  up  their  work (msg/start  “/queue/tweets”) ;;  The  scrapers (msg/listen  “/queue/tweets”  brandy.msg/scrape) ;;  The  work  producer (daemon/start  “streamer”  brandy.stream/start                                                    brandy.stream/stop) ;;  The  housekeeper (job/schedule  “housekeeper”  “0  0  0  *  *  ?”                                                        brandy.job/purge) Monday, March 19, 2012
  • 24. Immutant how? Monday, March 19, 2012
  • 25. Leiningen  Plugin $  lein  plugin  install  lein-­immutant  0.6.0 Monday, March 19, 2012
  • 26. Install $  lein  immutant  install  [version] Monday, March 19, 2012
  • 27. Install By  default,  the  plugin  installs   Immutant  beneath        ~/.lein/immutant/ Monday, March 19, 2012
  • 28. Run $  lein  immutant  run Monday, March 19, 2012
  • 29. Deploy $  lein  new  myapp $  cd  myapp $  lein  immutant  init $  $EDITOR  immutant.clj $  lein  immutant  deploy Monday, March 19, 2012
  • 30. Deploy A  “deployment  descriptor”  is  a   glorified  symlink  written  to   jboss/standalone/deployments Its  contents: {:root  "/the/path/to/your/app"} Monday, March 19, 2012
  • 31. Deploy Each  app  gets  a  dedicated   Clojure  runtime  and  classpath   containing  resolved   dependencies,  src,  lib,  and   resources. Monday, March 19, 2012
  • 32. project.clj (defproject  myapp  "1.2.3"    ...    :immutant  {:init  myapp.core/initialize                          :resolve-­dependencies  true                          :context-­path  "/"                          :swank-­port  4111                          :nrepl-­port  4112}) Monday, March 19, 2012
  • 33. Overlay $  lein  immutant  overlay  torquebox $  export  TORQUEBOX_HOME=$IMMUTANT_HOME Monday, March 19, 2012
  • 34. The  API immutant  namespaces Monday, March 19, 2012
  • 35. The  API • Dynamic  by  design • No  static  xml  files  or  annotations • Modules • Web • Messaging • Caching   • Scheduling • Daemons Monday, March 19, 2012
  • 36. immutant.web ring Monday, March 19, 2012
  • 37. Web • Supports  any  Ring-­based  handler • Ring  middleware  to  expose  the   Servlet  session • Multiple  web  apps  may  share  the   same  lifecycle  via  “subcontexts” Monday, March 19, 2012
  • 38. Web (require  ‘[immutant.web  :as  web]) (defn  my-­handler  [request]    {:status  200      :headers  {"Content-­Type"  "text/html"}      :body  "Hello  from  Immutant!"}) (web/start  "/hi"  my-­handler) Monday, March 19, 2012
  • 39. Context  paths project.clj (defproject  myapp  "1.2.3"  ...) immutant.clj (web/start  "/"  main) ;;;;  http://localhost:8080/myapp/ (web/start  "/admin"  admin) ;;;;  http://localhost:8080/myapp/admin Monday, March 19, 2012
  • 40. Context  paths project.clj (defproject  myapp  "1.2.3”    :immutant  {:context-­path  "/"}) immutant.clj (web/start  "/"  main) ;;;;  http://localhost:8080/ (web/start  "/admin"  admin) ;;;;  http://localhost:8080/admin Monday, March 19, 2012
  • 41. Session  Replication (require  ‘[immutant.web  :as  web]                  ‘[immutant.web.session  :as  iws]) (web/start  "/"    (ring-­session/wrap-­session        handler        {:store  (iws/servlet-­store)})) Monday, March 19, 2012
  • 42. immutant.messaging hornetq Monday, March 19, 2012
  • 43. Messaging publish-­subscribe point-­to-­point Monday, March 19, 2012
  • 44. Messaging (require  ‘[immutant.messaging  :as  msg]) (msg/start  "/queue/work") (msg/start  "/topic/news") Monday, March 19, 2012
  • 45. Producers ;;;;  Content  may  be  any  serializable ;;;;  data  structure (msg/publish  “/queue/work”  anything) Monday, March 19, 2012
  • 46. Producers ;;;;  May  be  as  complex  as  necessary (msg/publish  "/queue/work"      {:a  "b"  :c  [1  2  3  {:foo  42}]}) Monday, March 19, 2012
  • 47. Producers ;;;;  Support  priority  and  time-­to-­live (msg/publish  “/queue/work”                            a-­message                            :priority  :high                          :ttl  1000) Monday, March 19, 2012
  • 48. Producers ;;;;  Three  message  encodings: ;;;;  :clojure  :json  :text (msg/publish  "/queue/work"      {:a  "b"  :c  [1  2  3  {:foo  42}]}    :encoding  :json) Monday, March 19, 2012
  • 49. Messaging With  TorqueBox,  messages   comprised  of  standard  collections   and  types  are  transparently   interoperable  between  Clojure   and  Ruby  in  either  direction. Monday, March 19, 2012
  • 50. Consumers ;;;;  Block  until  message  arrives (let  [task  (msg/receive  "/queue/work")]    (perform  task)) Monday, March 19, 2012
  • 51. Consumers ;;;;  Create  a  lazy  sequence  of  messages (take  4  (msg/message-­seq  “/queue/foo”)) Monday, March 19, 2012
  • 52. Consumers (defn  upper-­caser  [s]    (msg/publish  "/topic/upper"                              (.toUpperCase  s))) ;;;;  Register  a  listener (msg/listen  "/queue/lower"  upper-­caser) Monday, March 19, 2012
  • 53. Messaging Automatic  retries,  failover  and   load-­balancing  when  clustered. Monday, March 19, 2012
  • 54. immutant.cache infinispan Monday, March 19, 2012
  • 55. Distributed  Cache • Backed  by  Infinispan  data  grid • Implements  core  Clojure  interfaces •core.cache/CacheProtocol • core.memoize  store Monday, March 19, 2012
  • 56. Infinispan • Eviction:  FIFO,  LRU • Expiration:  time-­to-­live,  idle  time • Persistence:  write-­through/behind • Transactional:  JTA/XA • MVCC-­based  concurrency • Flexible  clustering Monday, March 19, 2012
  • 57. Cache  Modes • :local  -­  non-­clustered • Clustered • :invalidated  -­  no  data  shared • :replicated  -­  all  data  shared • :distributed  -­  linear  scalability Monday, March 19, 2012
  • 61. immutant.cache • All  caches  have  a  name  and  a  mode   (:local,  :invalidated,  :replicated,   :distributed) • Like-­named  Immutant  caches  are   backed  by  the  same  Infinispan  cache Monday, March 19, 2012
  • 62. immutant.cache (require  ‘[immutant.cache  :as  ic]) (def  a  (ic/cache  “foo”  :replicated)) (def  b  (ic/cache  “bar”)) (def  c  (ic/cache  “foo”)) Monday, March 19, 2012
  • 63. immutant.cache (def  c  (ic/cache  “foo”)) (assoc  c  :a  1) (merge  c  {:b  2  :c  3}) (dissoc  c  :c) c  =>  {:a  1,  :b  2} Monday, March 19, 2012
  • 64. Memoization (require  ‘[immutant.cache  :as  ic]) (def  memoized-­fn  (ic/memo  slow-­fn  “foo”)) (memoized-­fn  1  2  3) (def  c  (ic/cache  “foo”)) c  =>  {[1  2  3]  42} Monday, March 19, 2012
  • 65. Explicit  writes (require  ‘[immutant.cache  :as  ic]) (def  opts  {:ttl  2  :idle  1  :units  :days}) (def  c  (ic/cache  “foo”)) (ic/put  c  key  value  opts) (ic/put-­if-­absent  c  key  value  opts) (ic/put-­if-­present  c  key  value  opts) (ic/put-­if-­replace  c  key  old  new  opts) (ic/delete  c  key) Monday, March 19, 2012
  • 66. immutant.jobs quartz Monday, March 19, 2012
  • 67. Scheduling (require  ‘[immutant.jobs  :as  job]) ;;;;  Once  a  month (job/schedule  "newsletter"                            "0  0  0  1  *  ?"                            news/monthly                            :singleton  true) Monday, March 19, 2012
  • 68. Scheduling “Fire  every  half  hour  from  10am  until  1pm  on   the  third  Friday  of  each  month” 0 */30 10-13 ? * FRI#3 Seconds Minutes Hours DOM Month DOW Year 1-7 1-12 1970- 1-31 SUN- 0-59 0-59 0-23 JAN- 2099 ?LW SAT DEC empty ?L# Monday, March 19, 2012
  • 69. Scheduling (require  ‘[immutant.jobs  :as  job]) (job/at  “name”  “3m”      #(println  “I  fire  after  3  minutes”)) (job/every  “name”  “1d”    #(println  “I  fire  once  a  day”)) Monday, March 19, 2012
  • 70. immutant.daemons long-­running  services Monday, March 19, 2012
  • 71. Daemons (require  ‘[immutant.daemons  :as  daemon]) (daemon/start  "name"  start-­fn  stop-­fn) Monday, March 19, 2012
  • 72. Daemons (def  response  (atom  nil)) (defn  start  []    (reset!  response        (twitter-­statuses-­filter              (terms)            url-­scraper))) (defn  stop  []      ((:cancel  (meta  @response)))) (daemon/start  "tweets"  start  stop                              :singleton  true) Monday, March 19, 2012
  • 73. Clustering simple  horizontal  scaling Monday, March 19, 2012
  • 74. Clustering $  lein  immutant  run  -­-­clustered Monday, March 19, 2012
  • 75. Clustering • Session  replication • Robust,  load-­balanced  message   distribution • HA  Singleton • HA  Jobs • Infinispan Monday, March 19, 2012
  • 76. mod_cluster • An  Apache  module  aware  of  JBoss • Reverse  proxy  via  AJP  or  HTTP[S] • Uses  load  statistics  and  deployment   availability  for  intelligent  routing • Optional  session  affinity • Failover Monday, March 19, 2012
  • 78. Coming  soon • Distributed  Transactions  (XA) • OpenShift  integration • Websockets • Better  remote  support • Domain  Mode  (cluster  management) Monday, March 19, 2012
  • 79. http://immutant.org #immutant   @immutants Monday, March 19, 2012