Developing “RESTful transactions” with Apache Sling

2,696
-1

Published on

Even though the topic sounds very boring, every CQ and Sling developer was at least once faced with the Question: "Is your solution supporting transactions?"

Most engineers are familiar with the theory and usage of transaction working in a old fashion J2EE environment. When transitioning to a modern REST application framework like Sling, we are facing many challenges. In most casesthe solution is to use hibernate or similar tools and to leave the RESTful world.

In this Session we will talk about transactions in general, explain the different kind of transactions and especially how to deal with services layers in conjunctions with Apache Sling. Various approaches, to help J2EE developers to transition fully to a RESTful world, will be explained.

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

  • Be the first to like this

No Downloads
Views
Total Views
2,696
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
33
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Developing “RESTful transactions” with Apache Sling

  1. 1. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 23-25 SEPTEMBER 2013 “RESTful transactions” with Apache Sling Şenol Taş
  2. 2. About adaptTo() 2013 2 §  My Name is Şenol Taş §  Senior Computer Scientist §  Adobe in Basel, Switzerland @thelabertasch
  3. 3. adaptTo() 2013 3 Why such a boring Topic?
  4. 4. Because websites are… adaptTo() 2013 4 §  No longer simple advertisement platforms §  Not only “online Business cards” §  Not a “nice to have” medium §  Not a “Playground” §  …..
  5. 5. Because websites are… adaptTo() 2013 5 §  Serious business §  Make $$$ §  Complex §  MUST have §  “Real” Applications
  6. 6. adaptTo() 2013 6 Your Website IS THE Application
  7. 7. Let’s…. adaptTo() 2013 7 §  Find out “what is a transaction?” §  Quick reminder about REST §  How do this two concepts work together?
  8. 8. adaptTo() 2013 8 What are Transactions?
  9. 9. What are Transactions? adaptTo() 2013 9
  10. 10. adaptTo() 2012 10 “An input message to a computer system that must be dealt with as a single unit of work”
  11. 11. What are Transactions? adaptTo() 2013 11 §  begin transaction §  debit checking account §  credit savings account §  update history log §  commit transaction
  12. 12. What are Transactions? adaptTo() 2013 12 §  Late 70s: Jim Gray defined the semantic of reliable transactions §  Early 80s: Andreas Reuter and Theo Härder defined the acronym “ACID” in their paper “Principles of Transaction- Oriented Database Recovery”
  13. 13. ACID adaptTo() 2013 13 §  Atomicity §  Consistency §  Isolation §  Durability
  14. 14. How do tools like hybernate help? adaptTo() 2013 14
  15. 15. adaptTo() 2013 15 What is REST?
  16. 16. What is REST? adaptTo() 2013 16 §  Representational State Transfer §  Stateless §  Client-server §  Cachable §  Scalable §  …..
  17. 17. What is REST? adaptTo() 2013 17 §  So? How does this work together with transactions?
  18. 18. adaptTo() 2013 18 REST and transaction is a oxymoron
  19. 19. REST and transactions adaptTo() 2013 19 §  Atomicity §  Consistency §  Isolation §  Durability
  20. 20. What are the challenges? adaptTo() 2013 20 §  HTTP REQUEST – RESPONSE PATTERN §  STATELESS §  …..?
  21. 21. Change your mindset… adaptTo() 2013 21 §  Not everything has to be done in one request §  If you are using POST.jsp or similar in Sling, most likely something is wrong §  Events and Observations are your friends §  Use the full power of the Sling Default Post and GET Servlet
  22. 22. Remember the cheat sheet from Lars? adaptTo() 2013 22
  23. 23. Example adaptTo() 2013 23 §  Resource: /home/senol/profile §  Begin transaction §  change interests §  Commit transaction
  24. 24. Begin Transaction adaptTo() 2013 24 §  Copy the node /home/senol/profile to /home/senol/transactions/profile/*
  25. 25. Change interests adaptTo() 2013 25 §  Update with regular post request
  26. 26. Commit transaction adaptTo() 2012 26 §  With observation or events §  Directly
  27. 27. Things of interest adaptTo() 2012 27 §  Communicating with services layer §  Distributed transactions §  Nested transactions §  Locking… §  Using Adobe CQ? §  Have a look at the Workflow Launcher!
  28. 28. adaptTo() 2013 28 Thank you and have a RESTful Day!

×