SlideShare a Scribd company logo
Transac6on	
  Management	
  with	
  
Apache	
  Camel,	
  ServiceMix	
  -­‐	
  EIPs	
  
Part	
  II	
  

Charles Moulliard – Raul Kripalani,
November 22nd, 2011


                                                                                                                                                                A	
  Progress	
  So3ware	
  Company	
  
1	
     Copyright	
  ©	
  2010	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                  A	
  Progress	
  So3ware	
  Company	
  
When you joined today’s session …

                              Audio is broadcast from your computer




                                                                                                                                        Submit your questions
                                                                                                                                         via the Chat Window

                                                                                                                                          Contact today’s Host
                                                                                                                                          via the Chat Window




2	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
      A	
  Progress	
  So3ware	
  Company	
  
Learn	
  More	
  at	
  hLp://fusesource.com	
  




3	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Speaker	
  –	
  Charles	
  Moulliard	
  

    Engineer	
  in	
  Agronomy	
  &	
  Master	
                                                                                                                Follow	
  me	
  on	
  :
                                                                                                                                                                                      	
  
     in	
  Zoology	
  
    17	
  years	
  of	
  experience	
  in	
  IT	
                                                                                                       	
  hLp://twiLer.com/cmoulliard	
  
     world	
  development	
  (J2EE,	
  .NET)	
  
                                                                                                                                                         	
  hLp://www.linkedin.com/in/
        •  Specialised	
  in	
  new	
  technologies	
  
                                                                                                                                                               charlesmoulliard	
  
           web/Internet	
  &	
  integra6on	
  
        •  Project	
  manager	
  in	
  bank,	
  financial,	
                                                                               	
  	
  	
  	
  	
  	
  	
  	
  	
  hLp://cmoulliard.blogspot.com	
  
           telco,	
  insurance	
  and	
  transport	
  
           world	
  
                                                                                                                                          	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  hLp://www.slideshare.net/
    Solu6on	
  Architect	
  at	
  FuseSource	
  	
  	
                                                                                                           cmoulliard	
  
    CommiLer	
  on	
  Apache	
  projects	
  :	
  	
  
        •  Apache	
  ServiceMix,	
  	
  Apache	
  Karaf	
  
           (PMC)	
  ,	
  Apache	
  Camel,	
  Fuse	
  Fabric,	
  
           Scalate	
  
4	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                          A	
  Progress	
  So3ware	
  Company	
  
Agenda	
  

  Goal	
  :	
  Transac6on	
  Management	
  with	
  Apache	
  
   Camel,	
  ServiceMix	
  -­‐	
  EIPs	
  
        • Transac6ons	
  with	
  Camel	
  
        • JMS	
  and	
  JDBC	
  alone	
  
        • Fuse	
  ESB	
  Tx	
  Manager	
  
        • Using	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
        • Persistence	
  with	
  EIPs	
  
           • Idempotent	
  processor	
  
           • Aggregator	
  
        • Summary	
  
5	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Table	
  of	
  contents	
  

  Transac6ons	
  with	
  Camel	
  
  JMS	
  and	
  JDBC	
  alone	
  
  Fuse	
  ESB	
  Tx	
  Manager	
  
  Using	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
  Persistence	
  with	
  EIPs	
  
        • Idempotent	
  processor	
  
        • Aggregator	
  
  Summary	
  

6	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  

  Camel	
  does	
  not	
  re-­‐invent	
  the	
  wheel	
  and	
  use	
  Spring	
  or	
  
   Blueprint	
  API	
  (on	
  Apache	
  ServiceMix)	
  

  Can	
  work	
  with	
  local	
  or	
  provided	
  Tx	
  Manager	
  
        •  Local	
  =	
  Spring	
  (JMS,	
  JPA,	
  JDBC,	
  Hibernate),	
  Atomikos,	
  
           Bitronix,	
  jOTM	
  
        •  Provided	
  =	
  J2EE	
  (WebSphere,	
  JBoss,	
  Glassfish,	
  BEA,	
  
           Geronimo),	
  Apache	
  ServiceMix	
  	
  




7	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  

  Factors	
  affec6ng	
  Architecture	
  depends	
  on	
  :	
  
        •  Component	
  (Transac6onal	
  or	
  not),	
  	
  
        •  Type	
  of	
  Transac6on	
  Manager	
  and	
  DataSource	
  (XA	
  or	
  not),	
  	
  
        •  Route	
  (simple,	
  complex),	
  
        •  Transacrion	
  Propaga6on	
  Type	
  (REQUIRED,	
  NEW,	
  
           MANDATORY,	
  ….)	
  
  How	
  to	
  configure	
  a	
  Camel	
  route	
  to	
  be	
  transac6onal	
  
  2	
  approaches	
  exist	
  and	
  they	
  can	
  be	
  combined	
  




8	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (1)	
  

A)	
  Using	
  a	
  Transac6onal	
  component	
  for	
  producer	
  or	
  
   consumer	
  

How	
  To	
  :	
  
  Check	
  which	
  component	
  are	
  Tx	
  
   aware	
  	
  jpa,	
  sql,	
  jms,	
  file,	
  
   hibernate,	
  iba6s.	
  
  Configure	
  a	
  Transac6on	
  Manager	
  
   for	
  the	
  endpoint	
  




9	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (2)	
  

  Simple	
  Transac6onal	
  JMS	
  client	
  configura6on	
  example	
  

                                                                                                                                        Spring JMS Tx manager
                                                                                                                                        is defined




                                                                                                                 Here we provide the parameters




10	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (3)	
  

B)	
  Configure	
  a	
  Camel	
  route	
  as	
  Transac6onal	
  
  Advantage	
  :	
  allow	
  to	
  include	
  processors	
  (beans,	
  jpa,	
  
    hibernate)	
  with	
  a	
  Transac6onal	
  route	
  
  How	
  to	
  configure	
  it	
  	
  add	
  <transacted>	
  to	
  the	
  route	
  
  How	
  does	
  it	
  work	
  
         •  Camel	
  will	
  automa6c	
  lookup	
  to	
  find	
  a	
  Spring	
  transac6on	
  
            manager	
  
            (org.springframework.transac6on.PlasormTransac6onManager)	
  
         •  Transac6on	
  Manager	
  creates	
  a	
  Transac6on	
  (according	
  to	
  
            PROPAGATION	
  Policy)	
  
         •  Transac6onError	
  handler	
  will	
  take	
  care	
  of	
  excep6ons	
  occuring	
  
            during	
  camel	
  exchange	
  and	
  propagated	
  it	
  to	
  the	
  caller	
  
11	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (4)	
  

  Example	
  of	
  Camel	
  Transac6on	
  route	
                                                                                                               A


                                                                                                                                                                                  B




                                                                                             Camel will lookup for
                                                                                             “PROPAGATION_REQUIRED”




12	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (5)	
  

  Reference	
  of	
  the	
  SpringTransac6onPolicy	
  can	
  be	
  provided	
  




                                                                                                                                       Reference to the bean




13	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (6)	
  

  Another	
  example	
  using	
  <Policy>	
  DSL	
  and	
  
   SpringTransac6onPolicy	
  is	
  provided	
  to	
  the	
  TxErrorHandler	
  




                                                                                                                                                         Transacted is replaced by Policy




14	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (7)	
  

  Transac6on	
  policy	
  can	
  be	
  defined	
  using	
  class	
  
   org.apache.camel.spi.TransactedPolicy	
  
  Policies	
  can	
  be	
  mixed	
  in	
  Camel	
  routes	
  to	
  use	
  different	
  
   transac6on	
  propaga6ons	
  (NEW,	
  REQUIRED,	
  …)	
  




15	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (8)	
  

  Example	
  of	
  2	
  Camel	
  routes	
  using	
  different	
  Policy	
  	
  	
  	
  
                                                                                                                                                                 Required policy : will use an
                                                                                                                                                                 existing Transaction or
                                                                                                                                                                 request to create a new



                                                                                                                                                                 Requires-New policy will
                                                                                                                                                                 request a new Transaction




16	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                    A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (9)	
  

  Transac6on	
  rollback	
  occurs	
  when	
  a	
  run6me	
  excep6on	
  is	
  
   raised	
  but	
  you	
  can	
  also	
  manage	
  it	
  using	
  <rollback>	
  DSL	
  




                                                                                                                                                                 We force a Rollback by
                                                                                                                                                                 generating a
                                                                                                                                                                 org.apache.camel.Rollbac
                                                                                                                                                                 kExchangeException




17	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
              A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (9)	
  

  Using	
  markRollBackOnly	
  generates	
  a	
  Rollback	
  without	
  
   excep6on	
  in	
  the	
  Camel	
  route	
  



                                                                                                                                                             Rollback occurs in BookService
                                                                                                                                                             (DB), exception is not send to
                                                                                                                                                             direct (which is not Tx aware)
                                                                                                                                                             and exception is send to mock
                                                                                                                                                             endpoint




18	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                  A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (10)	
  

  When	
  Apache	
  Camel	
  producer/consumer	
  is	
  not	
  
   Transac6onal,	
  a	
  compensa6on	
  mechanism	
  can	
  be	
  
   used.	
  
  Uses	
  a	
  synchronisa6on	
  mechanism	
  =	
  callback	
  (mimic	
  
   Tx)	
  to	
  group	
  tasks	
  as	
  a	
  UnitOfWork	
  
  Will	
  react	
  with	
  onComplete	
  (=commit)	
  or	
  onFailure	
  
   (=rollback)	
  




19	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (11)	
  




                                                                                                                                                                 onCompletion + link to the bean
                                                                                                                                                                 implementing the rollback logic




20	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                     A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (12)	
  




                                                                                                                                                        Rollback strategy




21	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                A	
  Progress	
  So3ware	
  Company	
  
Transac6ons	
  with	
  Camel	
  (13)	
  

  Be	
  carefull	
  about	
  threads,	
  threadPool	
  	
  
         •  Only	
  one	
  should	
  be	
  used,	
  
         •  Don't	
  use	
  seda://,	
  vm://,	
  NMR://	
  which	
  are	
  async	
  to	
  link	
  
            Camel	
  routes	
  
  Tx	
  async	
  are	
  not	
  supported	
  in	
  Camel	
  2.x	
  (planned	
  for	
  
   Camel	
  3.x)	
  
  More	
  info	
  :	
  hLp://fusesource.com/docs/router/2.8/
   transac6ons/TxnDemarca6on-­‐ErrorHandling.html	
  




22	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Table	
  of	
  contents	
  


  Transac6ons	
  with	
  Camel	
  
  JMS	
  and	
  JDBC	
  alone	
  
  Fuse	
  ESB	
  Tx	
  Manager	
  
  Using	
  a	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
  Persistence	
  with	
  EIPs	
  
         • Idempotent	
  processor	
  
         • Aggregator	
  
  Summary	
  

23	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  

  Integra6on	
  project,	
  most	
  probably,	
  will	
  use	
  not	
  only	
  1	
  
   Tx	
  Manager	
  but	
  a	
  combina6on	
  using	
  JMS	
  +	
  JDBC,	
  JDBC	
  
   +	
  JDBC,	
  JMS	
  +	
  JMS,	
  …	
  
  Such	
  a	
  project	
  can	
  use	
  Spring	
  or	
  Fuse	
  ESB	
  Tx	
  Managers	
  
  2	
  Approaches	
  are	
  available	
  on	
  Fuse	
  ESB	
  
         •  Spring	
  /	
  Spring	
  DM	
  (Dynamic	
  Modules)	
  
         •  Aries	
  Blueprint	
  
  Apache	
  Aries	
  project	
  =	
  implementa6on	
  of	
  Enterprise	
  
   features	
  of	
  OSGI	
  EE	
  specifica6ons	
  (Transac6on,	
  JPA,	
  
   JNDI,	
  Web)	
  	
  

24	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  

  Use	
  Case	
  descrip6on	
  	
  




25	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  (1)	
  -­‐	
  Spring	
  

  Example	
  of	
  a	
  project	
  containing	
  a	
  JPA,	
  Datasource	
  and	
  
   a	
  camel	
  route	
  with	
  Ac6veMQ	
  JMS	
  queues	
  
                                                                                                                                                                 DataSource is created using
                                                                                                                                                                 Apache Commons DBCP




                                                                                                                                                                    And is exported as OSGI
                                                                                                                                                                    Service wit h2 filters




26	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                   A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  (2)	
  -­‐	
  Spring	
  

  JPA	
  Persistence	
  file	
  –	
  transac6on-­‐type	
  =	
  "RESOURCE-­‐
   LOCAL"	
  




27	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  (3)	
  -­‐	
  Spring	
  



                                                                                                                                                                 Spring will inject persistence
                                                                                                                                                                 context




                                                                                                                                                                 Method will be added into
                                                                                                                                                                 an existing Transaction


28	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                    A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  (4)	
  -­‐	
  Spring	
  
                                                                                                                                                                 DAO will be scanned by spring
                                                                                                                                                                 to find @Annotation

                                                                                                                                                                  DAO is exposed as a service


                                                                                                                                                                  Spring will add Tx demarcation
                                                                                                                                                                  Based on @Transactional
                                                                                                                                                                  annotations




                                                                                                                                     Our Spring JPA Tx Manager is
                                                                                                                                     exported and will be used by Camel
                                                                                                                                     route                     A	
  Progress	
  So3ware	
  Company	
  
29	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  
JMS	
  and	
  JDBC	
  (5)	
  -­‐	
  Spring	
  
                                                                                                                                                                 Spring JMS Tx Manager




                                                                                                                                                                  Message rollbacked will be
                                                                                                                                                                  moved directly into the DLQ




                                                                                                                                                                   Transacted = true, ref to Tx
                                                                                                                                                                   manager, CACHE_NONE to
                                                                                                                                                                   avoid that Spring uses
                                                                                                                                                                   another session (thread))
30	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                    A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  (6)	
  -­‐	
  Spring	
  
                                                                                                                                                                 We search for JPA Tx Manager
  Camel	
  Spring	
  configura6on	
  


                                                                                                                                                                  We configure 2 Transaction
                                                                                                                                                                  Policy (one for JMS, other for
                                                                                                                                                                  JPA)




31	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                    A	
  Progress	
  So3ware	
  Company	
  
JMS	
  and	
  JDBC	
  (5)	
  -­‐	
  Spring	
  

  Apache	
  Camel	
  routes	
  
                                                                                                                                                                   JMS + JDBC




                                                                                                                                                                 JMS + JMS




32	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                    A	
  Progress	
  So3ware	
  Company	
  
Table	
  of	
  contents	
  


  Transac6ons	
  with	
  Camel	
  
  JMS	
  and	
  JDBC	
  alone	
  
  Fuse	
  ESB	
  Tx	
  Manager	
  
  Using	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
  Persistence	
  with	
  EIPs	
  
         • Idempotent	
  processor	
  
         • Aggregator	
  
  Summary	
  

33	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Fuse	
  ESB	
  –	
  Transac6on	
  Manager	
  

  Apache	
  ServiceMix	
  4.x	
  plasorm	
  (Fuse	
  ESB)	
  provides	
  a	
  
   Tx	
  Manager	
  
  Based	
  on	
  Apache	
  Geronimo	
  Tx	
  Manager	
  (JTA	
  1.1)	
  
  Deployed	
  using	
  feature	
  	
  transac6on	
  
  Contains	
  the	
  following	
  bundle	
      	
  




34	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Fuse	
  ESB	
  –	
  Transac6on	
  Manager	
  (1)	
  

  Can	
  be	
  used	
  as	
  a	
  Global	
  JTA	
  Tx	
  Manager	
  with	
  XA	
  
   Resource	
  
  Expose	
  through	
  OSGI	
  service	
  registry	
  interfaces	
   	
  


                                                                                                                                                                 Proxified objects
                                                                                                                                                                 available




35	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
              A	
  Progress	
  So3ware	
  Company	
  
Fuse	
  ESB	
  –	
  Transac6on	
  Manager	
  (2)	
  

  Timeout	
  and	
  Tx	
  log	
  file	
  can	
  be	
  customised	
  	
  




36	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Table	
  of	
  contents	
  


  Transac6ons	
  with	
  Camel	
  
  JMS	
  and	
  JDBC	
  alone	
  
  Fuse	
  ESB	
  Tx	
  Manager	
  
  Using	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
  Persistence	
  with	
  EIPs	
  
         • Idempotent	
  processor	
  
         • Aggregator	
  
  Summary	
  

37	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  

  Using	
  a	
  Global	
  Transac6on	
  Manager	
  on	
  Fuse	
  ESB	
  just	
  
   requires	
  that	
  we	
  use	
  JTA	
  and	
  configure	
  XA	
  resources	
  

  Verify	
  careful	
  regarding	
  to	
  the	
  choice	
  of	
  the	
  "drivers"	
  or
                                                                                       	
  
   "datasource"	
  that	
  you	
  will	
  use	
  (XA	
  aware)	
  

  You	
  do	
  not	
  need	
  to	
  use	
  Spring	
  JDBC,	
  JPA,	
  JMS,	
  
   Hibernate	
  Transac6on	
  Manager	
  	
  Aries	
  Tx	
  Manager	
   	
  



38	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  

  Use	
  Case	
  




39	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  (1)	
  

  What	
  will	
  change	
  :	
  Datasource	
  (JDBC)	
  
                                                                                                                                                                 Add a XA Datasource




                                                                                                                                                                 Export XA and non XA
                                                                                                                                                                 Datasource as OSGI
                                                                                                                                                                 services (will be used by JPA
                                                                                                                                                                 container)




40	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                   A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  (2)	
  

  JPA	
  -­‐	
  persistence.xml	
   	
  
                                                                                                                                                                 Use JTA instead of
                                                                                                                                                                 RESOURCE-LOCAL




   Configure JTA and non-JTA
   datasource

41	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                     A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  (3)	
  

  JPA	
  -­‐	
  spring	
  
                                                                                                       We call OSGI Service to retrieve
                                                                                                       the PlatformTransactionManager
                                                                                                       object managed by Aries TX
                                                                                                       Manager




42	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  (4)	
  

  JMS	
  –	
  XA	
  Connec6on	
  Pool	
  /	
  Resource	
  Manager	
  	
  




                                                                                                                                                                 ActiveMQ requires JTA
                                                                                                                                                                 Manager and
                                                                                                                                                                 XAPooledConnectionFactory




43	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                 A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  (4)	
  

  JMS	
  –	
  Ac6veMQ	
  component	
  




                                                                                                                        Transacted is false in this configuration
                                                                                                                        as Aries Tx xManager will take care !




44	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  (1)	
  

  Apache	
  Camel	
  Route	
                                                                                             We use the Global Tx Manager exposed
                                                                                                                          as OSGI Service through Spring
                                                                                                                          TransactionManager to get it for JPA
                                                                                                                          Service




45	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Global	
  Tx	
  Manager	
  -­‐	
  XA	
  (1)	
  

                                                                                                                                                   Nothing has changed except that
  Apache	
  Camel	
  Route	
                                                                                                                      you could use XA and non XA
                                                                                                                                                   connection pool for JMS




46	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
           A	
  Progress	
  So3ware	
  Company	
  
Demo	
  
Transac6ons	
  in	
  Ac6on	
  on	
  Fuse	
  ESB	
  !	
  




47	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Table	
  of	
  contents	
  


  Transac6ons	
  with	
  Camel	
  
  JMS	
  and	
  JDBC	
  alone	
  
  Fuse	
  ESB	
  Tx	
  Manager	
  
  Using	
  a	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
  Persistence	
  with	
  EIPs	
  
         • Idempotent	
  processor	
  
         • Aggregator	
  
  Summary	
  

48	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Idempotent	
  processor	
  




  Filter	
  out	
  duplicate	
  messages	
  
  Uses	
  an	
  Expression	
  to	
  calculate	
  a	
  unique	
  message	
  ID,	
  
   which	
  is	
  looked	
  up	
  in	
  the	
  repository	
  
  By	
  default,	
  memory	
  based	
  
  Supports	
  several	
  persistent	
  mode	
  
         •    FileIdempotentRepository	
  
         •    HazelcastIdempotentRepository	
  (Available	
  as	
  of	
  Camel	
  2.8)	
  
         •    JdbcMessageIdRepository	
  (Available	
  as	
  of	
  Camel	
  2.7)	
  
         •    JpaMessageIdRepository	
  

49	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Idempotent	
  processor	
  (1)	
  

  To	
  use	
  JPA	
  Repository,	
  simply	
  configure	
  a	
  persistence	
  
   file	
  
  We	
  use	
  as	
  Model	
  MessageProcessed	
  




50	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Idempotent	
  processor	
  (2)	
  

  Model	
  contains	
  
   info	
  about	
  
   propre6es	
  that	
  
   we	
  will	
  store	
  
   into	
  the	
  DB	
  

MessageID = key used to
filter out messages




 51	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Idempotent	
  processor	
  (3)	
  

  Spring	
  Tx	
  and	
  JPA	
  Template	
  must	
  be	
  configured	
  



                                                                                                                                                                 Spring Template




52	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
       A	
  Progress	
  So3ware	
  Company	
  
Idempotent	
  processor	
  (3)	
  

  Setup	
  JpaMessageIdRepository	
  

                                                                                                                                                                       Reference to the
                                                                                                                                                                       JPA template




                                                                                                                                                                 Ref for the Spring
                                                                                                                                                                 bean jpaStore




53	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
                A	
  Progress	
  So3ware	
  Company	
  
Demo	
  
Idempotent	
  Consumer	
  with	
  JPA	
  repo	
  




54	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Table	
  of	
  contents	
  


  Transac6ons	
  with	
  Camel	
  
  JMS	
  and	
  JDBC	
  alone	
  
  Fuse	
  ESB	
  Tx	
  Manager	
  
  Using	
  a	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
  Persistence	
  with	
  EIPs	
  
         • Idempotent	
  processor	
  
         • Aggregator	
  
  Summary	
  

55	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Aggregator	
  




  Allows	
  to	
  combine	
  messages	
  together	
  into	
  a	
  single	
  
   message	
  
  Support	
  :	
  
         •  JdbcAggregatorRepository	
  (Available	
  as	
  of	
  Camel	
  2.7)	
  
         •  HawtDBAggregatorRepository	
  (in-­‐memory	
  DB)	
  
  We	
  keep	
  in	
  DB	
  the	
  aggregated	
  object	
  as	
  blob	
  
  Allows	
  to	
  restart	
  aggrega6on	
  process	
  from	
  where	
  it	
  
   stops	
  !
56	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Aggregator	
  (1)	
  

  How	
  agregator	
  works	
  




57	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Aggregator	
  (2)	
  

  Configura6on	
  of	
  the	
  Persistent	
  Repository	
  

                                                                                                                                                                 Configure Repo
                                                                                                                                                                 with DataSource
                                                                                                                                                                 and Tx Manager




  And	
  DB	
  




58	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
         A	
  Progress	
  So3ware	
  Company	
  
Aggregator	
  (3)	
  

  MyAggrega6onstrategy	
  simply	
  concatenates	
  the	
  Body	
  using	
  old	
  
   and	
  new	
  exchange	
  




59	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Aggregator	
  (4)	
  

  Class	
  contains	
  
   Users	
  and	
  set	
  
   the	
  Key	
  id	
  =	
  
   FUSE	
  that	
  the	
  
   aggregator	
  will	
  
   use	
  on	
  the	
  
   Exchange	
  


              Id = key used




60	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Aggregator	
  (5)	
  

  Apache	
  Camel	
  route	
  refers	
  to	
  the	
  Persistent	
  Repository	
  




                                                                                                                                                                 Persistent
                                                                                                                                                                 repository




61	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
             A	
  Progress	
  So3ware	
  Company	
  
Demo	
  
Aggrega6on	
  with	
  JDBC	
  repository	
  




62	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Table	
  of	
  contents	
  


  Transac6ons	
  with	
  Camel	
  
  Fuse	
  ESB	
  Tx	
  Manager	
  
  JMS	
  and	
  JDBC	
  alone	
  
  Using	
  a	
  Global	
  Transac6on	
  Manager	
  (XA)	
  
  Persistence	
  with	
  EIPs	
  
         • Idempotent	
  processor	
  
         • Aggregator	
  
  Summary	
  

63	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Summary	
  

  Transac6ons	
  in	
  more	
  detail	
  
         •    Transac6onal	
  client	
  <-­‐>	
  Transacted	
  /	
  Policy	
  mode	
  
         •    Propaga6onPolicy	
  
         •    Rollback	
  strategies	
  
         •    UnitOfWork	
  to	
  synchronise	
  
  Present	
  a	
  configura6on	
  with	
  JDBC,	
  JMS	
  Tx	
  managers	
  
  Introduce	
  Fuse	
  ESB	
  Tx	
  Manager	
  
  Global	
  Transac6on	
  Manager	
  
  EIPs	
  persistent	
  
         •  Idempotent	
  processor/Consumer	
  
         •  Aggregator	
  



64	
      Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
For	
  More	
  Informa6on	
  


     fusesource.com	
  
         •        Free	
  downloads	
  
         •        Documenta6on	
  
         •        Geyng	
  Star6ng	
  	
  demo,	
  tools	
  and	
  advice	
  
         •        Webinars	
  on	
  	
  beginner	
  and	
  advanced	
  topics	
  
         •        White	
  papers	
  
         •        Customer	
  case	
  studies	
  
     Get	
  Help	
  
         •        Forums	
  
         •        Virtual	
  training	
  
         •        Consul6ng	
  
         •        Enterprise	
  subscrip6ons	
  


65	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  
Useful	
  references	
  

  Transac6ons	
  with	
  camel	
  /	
  Fuse	
  ESB	
  
    • hLp://fusesource.com/docs/router/2.8/
      transac6ons/index.html	
  
  EIPs	
  paLerns	
  
         • hLp://fusesource.com/docs/router/2.8/eip/
           MsgEnd-­‐Idempotent.html	
  	
  
         • hLp://fusesource.com/docs/router/2.8/eip/
           MsgRout-­‐Aggregator.html	
  
  Use	
  Case	
  –	
  Devoxx	
  Hands	
  on	
  Lab	
  
         • hLps://github.com/cmoulliard/Devoxx-­‐2011-­‐
           HandsOnLab	
  
66	
     Copyright	
  ©	
  2011	
  Progress	
  So3ware	
  Corpora6on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
     A	
  Progress	
  So3ware	
  Company	
  

More Related Content

PPT
An Introduction to Apache ServiceMix 4 - FUSE ESB
PDF
Service-Oriented Integration With Apache ServiceMix
PDF
Service Oriented Integration with ServiceMix
PDF
Introduction To OSGi
PDF
Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix
PDF
Apache ActiveMQ and Apache ServiceMix
PPT
ServiceMix 4 -- Integrating OSGi with JBI
PDF
Fusesource camel-persistence-part1-webinar-charles-moulliard
An Introduction to Apache ServiceMix 4 - FUSE ESB
Service-Oriented Integration With Apache ServiceMix
Service Oriented Integration with ServiceMix
Introduction To OSGi
Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix
Apache ActiveMQ and Apache ServiceMix
ServiceMix 4 -- Integrating OSGi with JBI
Fusesource camel-persistence-part1-webinar-charles-moulliard

Similar to Fusesource camel-persistence-part2-webinar-charles-moulliard (20)

PDF
Be jug 090611_apacheservicemix
PDF
Introduction to ActiveMQ Apollo
KEY
Apache Camel - JEEConf May 2011
KEY
What Riding the Camel can do to make integration easier for you
PDF
Enterprise Integration Patterns and DSL with Apache Camel
PDF
Leverage Enterprise Integration Patterns with Apache Camel and Twitter
PPTX
Apache camel overview dec 2011
PDF
Introducing Scalate, the Scala Template Engine
PDF
Syer Monitoring Integration And Batch
PPTX
Until Successful Component
PDF
Apache Camel Introduction
PPTX
(ZDM) Zero Downtime DB Migration to Oracle Cloud
PDF
Transaction launcher
PPTX
Until successful component in mule
PPTX
Until successful component
PPTX
Until successful component in mule
 
PPTX
Oracle Management Cloud newpres-v1.1
PDF
Graeme fleetwood 0 c
PDF
dmb Portfolio
KEY
Apache Camel
Be jug 090611_apacheservicemix
Introduction to ActiveMQ Apollo
Apache Camel - JEEConf May 2011
What Riding the Camel can do to make integration easier for you
Enterprise Integration Patterns and DSL with Apache Camel
Leverage Enterprise Integration Patterns with Apache Camel and Twitter
Apache camel overview dec 2011
Introducing Scalate, the Scala Template Engine
Syer Monitoring Integration And Batch
Until Successful Component
Apache Camel Introduction
(ZDM) Zero Downtime DB Migration to Oracle Cloud
Transaction launcher
Until successful component in mule
Until successful component
Until successful component in mule
 
Oracle Management Cloud newpres-v1.1
Graeme fleetwood 0 c
dmb Portfolio
Apache Camel
Ad

More from Charles Moulliard (17)

PDF
Security enforcement of Java Microservices with Apiman & Keycloak
PDF
Microservices with WildFly Swarm - JavaSI 2016
PDF
Develop a Mobile Application coonected to a REST backend
PDF
Security enforcement of Microservices with API Management
PDF
MicroService and MicroContainer with Apache Camel
PDF
Design a Mobil Hybrid Application connected to a REST Backend
PDF
Fuse technology-2015
PDF
Continuous Delivery & Integration with JBoss Fuse on Openshift
PDF
Development of social media projects with Apache Camel, Fabric8 & Hawtio
PDF
iPaas with Fuse Fabric Technology
PDF
Make easier Integration of your services with Fuse Solutions - RedHat 2013
PDF
Karaf ee-apachecon eu-2012
PDF
Cloud fuse-apachecon eu-2012
PPT
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
PDF
Devoxx 2011 integration-camel-cxf-servicemix-activemq
PDF
Fuse source parisjug-10052011
PPT
Apache ServiceMix4 : Dream platform for Java Integration
Security enforcement of Java Microservices with Apiman & Keycloak
Microservices with WildFly Swarm - JavaSI 2016
Develop a Mobile Application coonected to a REST backend
Security enforcement of Microservices with API Management
MicroService and MicroContainer with Apache Camel
Design a Mobil Hybrid Application connected to a REST Backend
Fuse technology-2015
Continuous Delivery & Integration with JBoss Fuse on Openshift
Development of social media projects with Apache Camel, Fabric8 & Hawtio
iPaas with Fuse Fabric Technology
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Karaf ee-apachecon eu-2012
Cloud fuse-apachecon eu-2012
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Devoxx 2011 integration-camel-cxf-servicemix-activemq
Fuse source parisjug-10052011
Apache ServiceMix4 : Dream platform for Java Integration
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Cloud computing and distributed systems.
PDF
KodekX | Application Modernization Development
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
MYSQL Presentation for SQL database connectivity
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Cloud computing and distributed systems.
KodekX | Application Modernization Development
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Building Integrated photovoltaic BIPV_UPV.pdf
Understanding_Digital_Forensics_Presentation.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx

Fusesource camel-persistence-part2-webinar-charles-moulliard

  • 1. Transac6on  Management  with   Apache  Camel,  ServiceMix  -­‐  EIPs   Part  II   Charles Moulliard – Raul Kripalani, November 22nd, 2011 A  Progress  So3ware  Company   1   Copyright  ©  2010  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 2. When you joined today’s session … Audio is broadcast from your computer Submit your questions via the Chat Window Contact today’s Host via the Chat Window 2   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 3. Learn  More  at  hLp://fusesource.com   3   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 4. Speaker  –  Charles  Moulliard     Engineer  in  Agronomy  &  Master   Follow  me  on  :   in  Zoology     17  years  of  experience  in  IT    hLp://twiLer.com/cmoulliard   world  development  (J2EE,  .NET)    hLp://www.linkedin.com/in/ •  Specialised  in  new  technologies   charlesmoulliard   web/Internet  &  integra6on   •  Project  manager  in  bank,  financial,                    hLp://cmoulliard.blogspot.com   telco,  insurance  and  transport   world                      hLp://www.slideshare.net/   Solu6on  Architect  at  FuseSource       cmoulliard     CommiLer  on  Apache  projects  :     •  Apache  ServiceMix,    Apache  Karaf   (PMC)  ,  Apache  Camel,  Fuse  Fabric,   Scalate   4   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 5. Agenda     Goal  :  Transac6on  Management  with  Apache   Camel,  ServiceMix  -­‐  EIPs   • Transac6ons  with  Camel   • JMS  and  JDBC  alone   • Fuse  ESB  Tx  Manager   • Using  Global  Transac6on  Manager  (XA)   • Persistence  with  EIPs   • Idempotent  processor   • Aggregator   • Summary   5   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 6. Table  of  contents     Transac6ons  with  Camel     JMS  and  JDBC  alone     Fuse  ESB  Tx  Manager     Using  Global  Transac6on  Manager  (XA)     Persistence  with  EIPs   • Idempotent  processor   • Aggregator     Summary   6   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 7. Transac6ons  with  Camel     Camel  does  not  re-­‐invent  the  wheel  and  use  Spring  or   Blueprint  API  (on  Apache  ServiceMix)     Can  work  with  local  or  provided  Tx  Manager   •  Local  =  Spring  (JMS,  JPA,  JDBC,  Hibernate),  Atomikos,   Bitronix,  jOTM   •  Provided  =  J2EE  (WebSphere,  JBoss,  Glassfish,  BEA,   Geronimo),  Apache  ServiceMix     7   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 8. Transac6ons  with  Camel     Factors  affec6ng  Architecture  depends  on  :   •  Component  (Transac6onal  or  not),     •  Type  of  Transac6on  Manager  and  DataSource  (XA  or  not),     •  Route  (simple,  complex),   •  Transacrion  Propaga6on  Type  (REQUIRED,  NEW,   MANDATORY,  ….)     How  to  configure  a  Camel  route  to  be  transac6onal     2  approaches  exist  and  they  can  be  combined   8   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 9. Transac6ons  with  Camel  (1)   A)  Using  a  Transac6onal  component  for  producer  or   consumer   How  To  :     Check  which  component  are  Tx   aware    jpa,  sql,  jms,  file,   hibernate,  iba6s.     Configure  a  Transac6on  Manager   for  the  endpoint   9   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 10. Transac6ons  with  Camel  (2)     Simple  Transac6onal  JMS  client  configura6on  example   Spring JMS Tx manager is defined Here we provide the parameters 10   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 11. Transac6ons  with  Camel  (3)   B)  Configure  a  Camel  route  as  Transac6onal     Advantage  :  allow  to  include  processors  (beans,  jpa,   hibernate)  with  a  Transac6onal  route     How  to  configure  it    add  <transacted>  to  the  route     How  does  it  work   •  Camel  will  automa6c  lookup  to  find  a  Spring  transac6on   manager   (org.springframework.transac6on.PlasormTransac6onManager)   •  Transac6on  Manager  creates  a  Transac6on  (according  to   PROPAGATION  Policy)   •  Transac6onError  handler  will  take  care  of  excep6ons  occuring   during  camel  exchange  and  propagated  it  to  the  caller   11   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 12. Transac6ons  with  Camel  (4)     Example  of  Camel  Transac6on  route   A B Camel will lookup for “PROPAGATION_REQUIRED” 12   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 13. Transac6ons  with  Camel  (5)     Reference  of  the  SpringTransac6onPolicy  can  be  provided   Reference to the bean 13   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 14. Transac6ons  with  Camel  (6)     Another  example  using  <Policy>  DSL  and   SpringTransac6onPolicy  is  provided  to  the  TxErrorHandler   Transacted is replaced by Policy 14   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 15. Transac6ons  with  Camel  (7)     Transac6on  policy  can  be  defined  using  class   org.apache.camel.spi.TransactedPolicy     Policies  can  be  mixed  in  Camel  routes  to  use  different   transac6on  propaga6ons  (NEW,  REQUIRED,  …)   15   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 16. Transac6ons  with  Camel  (8)     Example  of  2  Camel  routes  using  different  Policy         Required policy : will use an existing Transaction or request to create a new Requires-New policy will request a new Transaction 16   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 17. Transac6ons  with  Camel  (9)     Transac6on  rollback  occurs  when  a  run6me  excep6on  is   raised  but  you  can  also  manage  it  using  <rollback>  DSL   We force a Rollback by generating a org.apache.camel.Rollbac kExchangeException 17   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 18. Transac6ons  with  Camel  (9)     Using  markRollBackOnly  generates  a  Rollback  without   excep6on  in  the  Camel  route   Rollback occurs in BookService (DB), exception is not send to direct (which is not Tx aware) and exception is send to mock endpoint 18   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 19. Transac6ons  with  Camel  (10)     When  Apache  Camel  producer/consumer  is  not   Transac6onal,  a  compensa6on  mechanism  can  be   used.     Uses  a  synchronisa6on  mechanism  =  callback  (mimic   Tx)  to  group  tasks  as  a  UnitOfWork     Will  react  with  onComplete  (=commit)  or  onFailure   (=rollback)   19   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 20. Transac6ons  with  Camel  (11)   onCompletion + link to the bean implementing the rollback logic 20   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 21. Transac6ons  with  Camel  (12)   Rollback strategy 21   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 22. Transac6ons  with  Camel  (13)     Be  carefull  about  threads,  threadPool     •  Only  one  should  be  used,   •  Don't  use  seda://,  vm://,  NMR://  which  are  async  to  link   Camel  routes     Tx  async  are  not  supported  in  Camel  2.x  (planned  for   Camel  3.x)     More  info  :  hLp://fusesource.com/docs/router/2.8/ transac6ons/TxnDemarca6on-­‐ErrorHandling.html   22   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 23. Table  of  contents     Transac6ons  with  Camel     JMS  and  JDBC  alone     Fuse  ESB  Tx  Manager     Using  a  Global  Transac6on  Manager  (XA)     Persistence  with  EIPs   • Idempotent  processor   • Aggregator     Summary   23   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 24. JMS  and  JDBC     Integra6on  project,  most  probably,  will  use  not  only  1   Tx  Manager  but  a  combina6on  using  JMS  +  JDBC,  JDBC   +  JDBC,  JMS  +  JMS,  …     Such  a  project  can  use  Spring  or  Fuse  ESB  Tx  Managers     2  Approaches  are  available  on  Fuse  ESB   •  Spring  /  Spring  DM  (Dynamic  Modules)   •  Aries  Blueprint     Apache  Aries  project  =  implementa6on  of  Enterprise   features  of  OSGI  EE  specifica6ons  (Transac6on,  JPA,   JNDI,  Web)     24   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 25. JMS  and  JDBC     Use  Case  descrip6on     25   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 26. JMS  and  JDBC  (1)  -­‐  Spring     Example  of  a  project  containing  a  JPA,  Datasource  and   a  camel  route  with  Ac6veMQ  JMS  queues   DataSource is created using Apache Commons DBCP And is exported as OSGI Service wit h2 filters 26   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 27. JMS  and  JDBC  (2)  -­‐  Spring     JPA  Persistence  file  –  transac6on-­‐type  =  "RESOURCE-­‐ LOCAL"   27   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 28. JMS  and  JDBC  (3)  -­‐  Spring   Spring will inject persistence context Method will be added into an existing Transaction 28   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 29. JMS  and  JDBC  (4)  -­‐  Spring   DAO will be scanned by spring to find @Annotation DAO is exposed as a service Spring will add Tx demarcation Based on @Transactional annotations Our Spring JPA Tx Manager is exported and will be used by Camel route A  Progress  So3ware  Company   29   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.    
  • 30. JMS  and  JDBC  (5)  -­‐  Spring   Spring JMS Tx Manager Message rollbacked will be moved directly into the DLQ Transacted = true, ref to Tx manager, CACHE_NONE to avoid that Spring uses another session (thread)) 30   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 31. JMS  and  JDBC  (6)  -­‐  Spring   We search for JPA Tx Manager   Camel  Spring  configura6on   We configure 2 Transaction Policy (one for JMS, other for JPA) 31   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 32. JMS  and  JDBC  (5)  -­‐  Spring     Apache  Camel  routes   JMS + JDBC JMS + JMS 32   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 33. Table  of  contents     Transac6ons  with  Camel     JMS  and  JDBC  alone     Fuse  ESB  Tx  Manager     Using  Global  Transac6on  Manager  (XA)     Persistence  with  EIPs   • Idempotent  processor   • Aggregator     Summary   33   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 34. Fuse  ESB  –  Transac6on  Manager     Apache  ServiceMix  4.x  plasorm  (Fuse  ESB)  provides  a   Tx  Manager     Based  on  Apache  Geronimo  Tx  Manager  (JTA  1.1)     Deployed  using  feature    transac6on     Contains  the  following  bundle     34   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 35. Fuse  ESB  –  Transac6on  Manager  (1)     Can  be  used  as  a  Global  JTA  Tx  Manager  with  XA   Resource     Expose  through  OSGI  service  registry  interfaces     Proxified objects available 35   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 36. Fuse  ESB  –  Transac6on  Manager  (2)     Timeout  and  Tx  log  file  can  be  customised     36   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 37. Table  of  contents     Transac6ons  with  Camel     JMS  and  JDBC  alone     Fuse  ESB  Tx  Manager     Using  Global  Transac6on  Manager  (XA)     Persistence  with  EIPs   • Idempotent  processor   • Aggregator     Summary   37   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 38. Global  Tx  Manager  -­‐  XA     Using  a  Global  Transac6on  Manager  on  Fuse  ESB  just   requires  that  we  use  JTA  and  configure  XA  resources     Verify  careful  regarding  to  the  choice  of  the  "drivers"  or   "datasource"  that  you  will  use  (XA  aware)     You  do  not  need  to  use  Spring  JDBC,  JPA,  JMS,   Hibernate  Transac6on  Manager    Aries  Tx  Manager     38   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 39. Global  Tx  Manager  -­‐  XA     Use  Case   39   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 40. Global  Tx  Manager  -­‐  XA  (1)     What  will  change  :  Datasource  (JDBC)   Add a XA Datasource Export XA and non XA Datasource as OSGI services (will be used by JPA container) 40   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 41. Global  Tx  Manager  -­‐  XA  (2)     JPA  -­‐  persistence.xml     Use JTA instead of RESOURCE-LOCAL Configure JTA and non-JTA datasource 41   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 42. Global  Tx  Manager  -­‐  XA  (3)     JPA  -­‐  spring   We call OSGI Service to retrieve the PlatformTransactionManager object managed by Aries TX Manager 42   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 43. Global  Tx  Manager  -­‐  XA  (4)     JMS  –  XA  Connec6on  Pool  /  Resource  Manager     ActiveMQ requires JTA Manager and XAPooledConnectionFactory 43   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 44. Global  Tx  Manager  -­‐  XA  (4)     JMS  –  Ac6veMQ  component   Transacted is false in this configuration as Aries Tx xManager will take care ! 44   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 45. Global  Tx  Manager  -­‐  XA  (1)     Apache  Camel  Route   We use the Global Tx Manager exposed as OSGI Service through Spring TransactionManager to get it for JPA Service 45   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 46. Global  Tx  Manager  -­‐  XA  (1)   Nothing has changed except that   Apache  Camel  Route   you could use XA and non XA connection pool for JMS 46   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 47. Demo   Transac6ons  in  Ac6on  on  Fuse  ESB  !   47   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 48. Table  of  contents     Transac6ons  with  Camel     JMS  and  JDBC  alone     Fuse  ESB  Tx  Manager     Using  a  Global  Transac6on  Manager  (XA)     Persistence  with  EIPs   • Idempotent  processor   • Aggregator     Summary   48   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 49. Idempotent  processor     Filter  out  duplicate  messages     Uses  an  Expression  to  calculate  a  unique  message  ID,   which  is  looked  up  in  the  repository     By  default,  memory  based     Supports  several  persistent  mode   •  FileIdempotentRepository   •  HazelcastIdempotentRepository  (Available  as  of  Camel  2.8)   •  JdbcMessageIdRepository  (Available  as  of  Camel  2.7)   •  JpaMessageIdRepository   49   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 50. Idempotent  processor  (1)     To  use  JPA  Repository,  simply  configure  a  persistence   file     We  use  as  Model  MessageProcessed   50   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 51. Idempotent  processor  (2)     Model  contains   info  about   propre6es  that   we  will  store   into  the  DB   MessageID = key used to filter out messages 51   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 52. Idempotent  processor  (3)     Spring  Tx  and  JPA  Template  must  be  configured   Spring Template 52   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 53. Idempotent  processor  (3)     Setup  JpaMessageIdRepository   Reference to the JPA template Ref for the Spring bean jpaStore 53   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 54. Demo   Idempotent  Consumer  with  JPA  repo   54   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 55. Table  of  contents     Transac6ons  with  Camel     JMS  and  JDBC  alone     Fuse  ESB  Tx  Manager     Using  a  Global  Transac6on  Manager  (XA)     Persistence  with  EIPs   • Idempotent  processor   • Aggregator     Summary   55   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 56. Aggregator     Allows  to  combine  messages  together  into  a  single   message     Support  :   •  JdbcAggregatorRepository  (Available  as  of  Camel  2.7)   •  HawtDBAggregatorRepository  (in-­‐memory  DB)     We  keep  in  DB  the  aggregated  object  as  blob     Allows  to  restart  aggrega6on  process  from  where  it   stops  ! 56   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 57. Aggregator  (1)     How  agregator  works   57   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 58. Aggregator  (2)     Configura6on  of  the  Persistent  Repository   Configure Repo with DataSource and Tx Manager   And  DB   58   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 59. Aggregator  (3)     MyAggrega6onstrategy  simply  concatenates  the  Body  using  old   and  new  exchange   59   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 60. Aggregator  (4)     Class  contains   Users  and  set   the  Key  id  =   FUSE  that  the   aggregator  will   use  on  the   Exchange   Id = key used 60   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 61. Aggregator  (5)     Apache  Camel  route  refers  to  the  Persistent  Repository   Persistent repository 61   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 62. Demo   Aggrega6on  with  JDBC  repository   62   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 63. Table  of  contents     Transac6ons  with  Camel     Fuse  ESB  Tx  Manager     JMS  and  JDBC  alone     Using  a  Global  Transac6on  Manager  (XA)     Persistence  with  EIPs   • Idempotent  processor   • Aggregator     Summary   63   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 64. Summary     Transac6ons  in  more  detail   •  Transac6onal  client  <-­‐>  Transacted  /  Policy  mode   •  Propaga6onPolicy   •  Rollback  strategies   •  UnitOfWork  to  synchronise     Present  a  configura6on  with  JDBC,  JMS  Tx  managers     Introduce  Fuse  ESB  Tx  Manager     Global  Transac6on  Manager     EIPs  persistent   •  Idempotent  processor/Consumer   •  Aggregator   64   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 65. For  More  Informa6on     fusesource.com   •  Free  downloads   •  Documenta6on   •  Geyng  Star6ng    demo,  tools  and  advice   •  Webinars  on    beginner  and  advanced  topics   •  White  papers   •  Customer  case  studies     Get  Help   •  Forums   •  Virtual  training   •  Consul6ng   •  Enterprise  subscrip6ons   65   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company  
  • 66. Useful  references     Transac6ons  with  camel  /  Fuse  ESB   • hLp://fusesource.com/docs/router/2.8/ transac6ons/index.html     EIPs  paLerns   • hLp://fusesource.com/docs/router/2.8/eip/ MsgEnd-­‐Idempotent.html     • hLp://fusesource.com/docs/router/2.8/eip/ MsgRout-­‐Aggregator.html     Use  Case  –  Devoxx  Hands  on  Lab   • hLps://github.com/cmoulliard/Devoxx-­‐2011-­‐ HandsOnLab   66   Copyright  ©  2011  Progress  So3ware  Corpora6on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  So3ware  Company