SOA in the API World - Facades, Transactions, Stateless Services
-
Upload
apigee -
Category
Technology
-
view
5.452 -
download
2
description
Transcript of SOA in the API World - Facades, Transactions, Stateless Services
![Page 1: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/1.jpg)
SOA in the API World –Facades, Transactions, Stateless Services . . .
Apigee@apigee
Brian Pagano@brianpagano
Greg Brail@gbrail
![Page 2: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/2.jpg)
groups.google.com/group/api-craft
![Page 3: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/3.jpg)
youtube.com/apigee
![Page 4: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/4.jpg)
slideshare.net/apigee
![Page 5: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/5.jpg)
@brianpaganoBrian Pagano
@gbrailGreg Brail
![Page 6: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/6.jpg)
SOA’s Adventures in API-Land - Recap
Services? I’ve got services! (Designing a Façade)
Layers: Separation of Responsibility (which Transactions?)
Do I make my services stateless?
How to design internal APIs?
Overview
![Page 7: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/7.jpg)
Previously onSOA’s Adventures in API-Land…
![Page 8: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/8.jpg)
Let’s make sure we’re all talking about the same thing.And let’s only talk about the core principles of SOA, not the cruft that vendors have added on.
Some product features have started to be thought of as necessary for SOA.
SOA recap
![Page 9: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/9.jpg)
But SOA is about Service Oriented Architecture.
Services are good.
This taps into the deeper philosophy of breaking down problems into components.
Components are good.
![Page 10: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/10.jpg)
A service oriented architecture might include, but does not require:
• Heavyweight contracts• Service registries• Dynamic discovery
These are product “features”.
![Page 11: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/11.jpg)
Services? I’ve Got Services
![Page 12: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/12.jpg)
You’ve got servicesNow you need to design a Facade
![Page 13: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/13.jpg)
Avoid the forklift anti-pattern
![Page 14: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/14.jpg)
What are your service consumers using?
(Customers, partners, …)
![Page 15: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/15.jpg)
What are your company goals for this API?
revenue, reach, holding market share, re-using existing assets
![Page 16: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/16.jpg)
Design a single, RESTful façade that looks outside-in
Don’t expose implementation complexity
![Page 17: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/17.jpg)
Transformation OnboardingProtocol Mediation
Big System
DBContent
Management SOAP JDBC
AppApp
Developer
XML
Routing Authentication Traffic Mgmt Caching Monitoring
API Facade
![Page 18: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/18.jpg)
Be consistent
![Page 19: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/19.jpg)
Do what developers are expecting.
![Page 20: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/20.jpg)
Layers:Separation of Responsibility
![Page 21: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/21.jpg)
What types of things should a proxy do?
![Page 22: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/22.jpg)
What types of things would you not want to do in a proxy?
![Page 23: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/23.jpg)
Do I Make My Services Stateless?
![Page 24: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/24.jpg)
Yes. Make your services stateless.
Unless you have a good reason not to.
![Page 25: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/25.jpg)
But, what do we mean by “stateless”?
State can be either data entity state or session/activity state.
![Page 26: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/26.jpg)
A stateless service never holds data or business domain state.
A stateless service minimizes holding any activity or processing state information. (Session data is especially bad)
![Page 27: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/27.jpg)
Consider a shopping cart:
A. The client maintains the state and sends the whole thing back and forth every timeor:
B. The server maintains the cart in memory via a temporary “session ID”, and the server empties the cart after some inactivityor:
B. The server maintains the cart in a database via a permanent “shopping cart ID”
![Page 28: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/28.jpg)
Plan A: Requiring the client to maintain all state – is impractical
Plan C : Storing the state in a database – gives the developer what they expect, and gives business benefits too
But Plan B: A “session” – was popular in the Web 1.0 era but is unnecessary in today’s world of scalable and available databases
![Page 29: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/29.jpg)
How To Design Internal APIs
![Page 30: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/30.jpg)
No
Are Internal APIs Just SOA?
![Page 31: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/31.jpg)
Internal APIs are APIs which are not exposed to the outside world.
SOA is SOA
Let’s keep these things straight.
![Page 32: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/32.jpg)
Design internal APIs with the same level of consumability as you would an externally-facing API.
![Page 33: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/33.jpg)
Why should you use APIs rather than SOA as the model for your internal services?
You will want to use the same services for both mobile apps and your web apps
You don’t know what kinds of device technology your API will need to support in the future
You don’t know what kinds of web app technology your developers will want to use in the future
You do know that it will all change and you will have to adapt quickly
![Page 34: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/34.jpg)
Down the road, who knows . . .
What does “internal” mean anyway?
Besides, you might use them again for a different audience.
![Page 35: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/35.jpg)
In Sum
SOA still has uses in the API worldAn API layer is critical to meet today’s business
demandsSometimes they work well togetherExpose functionality, not systems or
implementation complexity
![Page 36: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/36.jpg)
![Page 37: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/37.jpg)
Questions
![Page 38: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/38.jpg)
groups.google.com/group/api-craft
![Page 39: SOA in the API World - Facades, Transactions, Stateless Services](https://reader035.fdocuments.us/reader035/viewer/2022081414/54bd8ba54a7959ca5a8b45bf/html5/thumbnails/39.jpg)
THANK YOUQuestions and ideas to:
@brianpagano@gbrail
groups.google.com/group/api-craft