SlideShare a Scribd company logo
1 of 39
Essential API Facade Patterns
Episode 3 – One Phase to Two Phase
Conversion



Santanu Dey                           Apigee
@Santanu_Dey                         @apigee
groups.google.com/group/api-craft
slideshare.net/apigee
youtube.com/apigee
@Santanu_Dey
 Santanu Dey
Webcast Series: API Facade Patterns


Episode 1
Composition

Episode 2
Session Management

Episode 3
One Phase to Two Phase Conversion

Episode 4
Synchronous to Asynchronous
Episode 3 : One-Phase to Two-Phase Conversion




Problem
Solution
Benefits
Considerations
Problem




How to expose a single phase API out of a two phase API


   To enable API teams and app developers to implement and
   improve their API designs and apps
Problem




From the point of view of the API provider, how to
expose a single phase API out of a two phase API

                                 1
   One Phase                             Two Phase
   Consumer                      2
                                          Provider
What is a Two Phase Interface?
First Phase – Prepare (or Vote)

                                   Participating
               prepare              Resource 1



                         prepare
                                            Participating
    Tx Coordinator                           Resource 2


                         prepare


                                      Participating
                                       Resource 3
Second Phase - Commit

                               Participating
                                Resource 1
             commit



                      commit            Participating
   Tx Coordinator                        Resource 2


                      commit



                                  Participating
                                   Resource 3
Two phase commit works well for server-side
distributed architecture
Not such a good idea for an app to consume a
two-phase API


                     prepare

                                       Service
        App
                                       Provider
                      commit
Transaction reliability is seldom a requirement for a
JavaScript plugin or an app
Making the app a transaction coordinator is asking the
developer to do too much

- to think about roll back, compensation etc.

-device runtime not well suited for heavy programming logic
Problems with Service Composition on Device

“chatty service” anti-pattern – multiple callouts from
client app to multi services


                  1. Get user attributes
                  2. Get recommended topics                 API
                                                          Provider
                  3. Get recommended books
  Client
           Network connection, negotiate security, data
           format & parsing
Problems with Service Composition on Device

                         Heavy data usage
                      Too many network calls
                           Battery drain
                           Performance
                     1. Get user attributes
                     2. Get recommended topics                      API
                     3. Get recommended books                     Provider


 Client
          Network connection, negotiate security, data format &
          parsing
Solution
One Phase to Two Phase Conversion using API Façade




The solution is to introduce an API Façade in the middle
which can handle the conversion

                                 1
   One Phase                             Two Phase
   Consumer                      2
                                          Provider
One Phase to Two Phase Conversion using API Façade




                                   1
 One Phase                                Two Phase
 Consumer                          2
                                           Provider




/reserve
/payment
One Phase to Two Phase Conversion using API Façade




                                   1
 One Phase                                Two Phase
 Consumer                          2
                                           Provider




/payment
Warning! UML Ahead
If I am missing something, please let me know, but for
now I consider ”REST transaction" to be an
oxymoron.

- Roy Fielding
Example of the API Façade


                          API Façade




                        API
                                    Existing     Backend
                     Exposure &
                                  Capabilities    Server
                       Mgmt.

App relies on REST
Benefits
Re-use existing enterprise backend
The client app avoids complexities like managing
transactions = Lovable API
Distributed Transaction Management

                                     1
                                         Two Phase
                                     2
                                          Provider


  One Phase
  Consumer

                                     1
                                         Two Phase
                                     2
                                          Provider
Resource states do not need to be maintained
Other Considerations
What is the trade-off?


Ability to coordinate distributed transaction from the client
Is it Possible to Expose Two-Phase API in REST?
Here is an Example
 POST /transfer/transaction
 {”from":”account1”, ”to”:”account2”, "amount":100}

 Response:
 {"id":"/transfer/transaction/123", "state":”started", blah blah}



 PUT /transfer/transaction/123
 {"id":"/transfer/transaction/123", "state":"committed", ...}

 Response:
 {"id":"/transfer/transaction/123", "state":”comitted", blah blah}
Questions?
THANK YOU
Subscribe to API webcasts at:
youtube.com/apigee



                                 Apigee
                                @apigee
THANK YOU
Questions and ideas to:
groups.google.com/group/api-craft



                                     Apigee
                                    @apigee
THANK YOU
Contact me at:

@Santanu_Dey
sdey@apigee.com




                   Apigee
                  @apigee

More Related Content

What's hot

Visbility at the Edge - Deep Insights from Your API
 Visbility at the Edge - Deep Insights from Your API Visbility at the Edge - Deep Insights from Your API
Visbility at the Edge - Deep Insights from Your APIApigee | Google Cloud
 
More Coverage, Better Diagnostics
More Coverage, Better DiagnosticsMore Coverage, Better Diagnostics
More Coverage, Better DiagnosticsSmartBear
 
WebSphere Connect and API Discovery
WebSphere Connect and API DiscoveryWebSphere Connect and API Discovery
WebSphere Connect and API Discovery Arthur De Magalhaes
 
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services AccessibleUsing IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services AccessibleArthur De Magalhaes
 
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7CA API Management
 
Open APIs: What's Hot, What's Not?
Open APIs: What's Hot, What's Not?Open APIs: What's Hot, What's Not?
Open APIs: What's Hot, What's Not?John Musser
 
Mocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanMocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanNordic APIs
 
API Strategy Evolution at Netflix
API Strategy Evolution at NetflixAPI Strategy Evolution at Netflix
API Strategy Evolution at NetflixMichael Hart
 
HAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
HAM 1032 Combining the Power of IBM API Management and IBM Integration BusHAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
HAM 1032 Combining the Power of IBM API Management and IBM Integration BusKaren Broughton-Mabbitt
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API GatewayMark Bate
 
All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]Cloud Elements
 
Past, Present and Future of APIs of Mobile and Web Apps
Past, Present and Future of APIs of Mobile and Web AppsPast, Present and Future of APIs of Mobile and Web Apps
Past, Present and Future of APIs of Mobile and Web AppsSmartBear
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST APIstephenbhadran
 
Enterprise Spring Building Scalable Applications
Enterprise Spring Building Scalable ApplicationsEnterprise Spring Building Scalable Applications
Enterprise Spring Building Scalable ApplicationsGordon Dickens
 
Exposing APIs with Liberty and Swagger
Exposing APIs with Liberty and SwaggerExposing APIs with Liberty and Swagger
Exposing APIs with Liberty and SwaggerArthur De Magalhaes
 
A great api is hard to find
A great api is hard to findA great api is hard to find
A great api is hard to findDan Diephouse
 
Build Your Business Process On A Solid Foundation–Web Sphere Application Server
Build Your Business Process On A Solid Foundation–Web Sphere Application ServerBuild Your Business Process On A Solid Foundation–Web Sphere Application Server
Build Your Business Process On A Solid Foundation–Web Sphere Application ServerCarly Snodgrass
 

What's hot (20)

Visbility at the Edge - Deep Insights from Your API
 Visbility at the Edge - Deep Insights from Your API Visbility at the Edge - Deep Insights from Your API
Visbility at the Edge - Deep Insights from Your API
 
More Coverage, Better Diagnostics
More Coverage, Better DiagnosticsMore Coverage, Better Diagnostics
More Coverage, Better Diagnostics
 
Huge: Running an API at Scale
Huge: Running an API at ScaleHuge: Running an API at Scale
Huge: Running an API at Scale
 
WebSphere Connect and API Discovery
WebSphere Connect and API DiscoveryWebSphere Connect and API Discovery
WebSphere Connect and API Discovery
 
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services AccessibleUsing IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
 
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
 
Open APIs: What's Hot, What's Not?
Open APIs: What's Hot, What's Not?Open APIs: What's Hot, What's Not?
Open APIs: What's Hot, What's Not?
 
Mocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanMocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with Postman
 
API Strategy Evolution at Netflix
API Strategy Evolution at NetflixAPI Strategy Evolution at Netflix
API Strategy Evolution at Netflix
 
HAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
HAM 1032 Combining the Power of IBM API Management and IBM Integration BusHAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
HAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
 
All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]
 
Past, Present and Future of APIs of Mobile and Web Apps
Past, Present and Future of APIs of Mobile and Web AppsPast, Present and Future of APIs of Mobile and Web Apps
Past, Present and Future of APIs of Mobile and Web Apps
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST API
 
Api design part 1
Api design part 1Api design part 1
Api design part 1
 
Enterprise Spring Building Scalable Applications
Enterprise Spring Building Scalable ApplicationsEnterprise Spring Building Scalable Applications
Enterprise Spring Building Scalable Applications
 
RAML
RAMLRAML
RAML
 
Exposing APIs with Liberty and Swagger
Exposing APIs with Liberty and SwaggerExposing APIs with Liberty and Swagger
Exposing APIs with Liberty and Swagger
 
A great api is hard to find
A great api is hard to findA great api is hard to find
A great api is hard to find
 
Build Your Business Process On A Solid Foundation–Web Sphere Application Server
Build Your Business Process On A Solid Foundation–Web Sphere Application ServerBuild Your Business Process On A Solid Foundation–Web Sphere Application Server
Build Your Business Process On A Solid Foundation–Web Sphere Application Server
 

Viewers also liked

HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy Apigee | Google Cloud
 
The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs
The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIsThe Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs
The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIsApigee | Google Cloud
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceApigee | Google Cloud
 
Crafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to KnowCrafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to KnowApigee | Google Cloud
 
Building your first Native iOs App with an API Backend
Building your first Native iOs App with an API BackendBuilding your first Native iOs App with an API Backend
Building your first Native iOs App with an API BackendApigee | Google Cloud
 
Driving Digital Success: Three ROI Criteria for Competitive Advantage
Driving Digital Success:  Three ROI Criteria for Competitive Advantage Driving Digital Success:  Three ROI Criteria for Competitive Advantage
Driving Digital Success: Three ROI Criteria for Competitive Advantage Apigee | Google Cloud
 
The New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIsThe New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIsApigee | Google Cloud
 
The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)Apigee | Google Cloud
 
Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast) Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast) Apigee | Google Cloud
 
APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?Apigee | Google Cloud
 
DevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile AppsDevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile AppsApigee | Google Cloud
 
Economic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIsEconomic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIsApigee | Google Cloud
 
API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)Apigee | Google Cloud
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)Apigee | Google Cloud
 
How to (almost certainly) fail: Building vs. buying your API infrastructure
How to (almost certainly) fail: Building vs. buying your API infrastructureHow to (almost certainly) fail: Building vs. buying your API infrastructure
How to (almost certainly) fail: Building vs. buying your API infrastructureApigee | Google Cloud
 
API Product Management - Driving Success through the Value Chain
API Product Management - Driving Success through the Value ChainAPI Product Management - Driving Success through the Value Chain
API Product Management - Driving Success through the Value ChainApigee | Google Cloud
 
Field Study 4 Episode 3
Field Study 4 Episode 3Field Study 4 Episode 3
Field Study 4 Episode 3Yuna Lesca
 

Viewers also liked (19)

HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy
 
The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs
The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIsThe Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs
The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile Performance
 
Crafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to KnowCrafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to Know
 
Building your first Native iOs App with an API Backend
Building your first Native iOs App with an API BackendBuilding your first Native iOs App with an API Backend
Building your first Native iOs App with an API Backend
 
Driving Digital Success: Three ROI Criteria for Competitive Advantage
Driving Digital Success:  Three ROI Criteria for Competitive Advantage Driving Digital Success:  Three ROI Criteria for Competitive Advantage
Driving Digital Success: Three ROI Criteria for Competitive Advantage
 
The New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIsThe New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIs
 
The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)
 
Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast) Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast)
 
APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?
 
DevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile AppsDevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile Apps
 
Economic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIsEconomic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIs
 
API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)
 
APIs & Copyrights
APIs & CopyrightsAPIs & Copyrights
APIs & Copyrights
 
How to (almost certainly) fail: Building vs. buying your API infrastructure
How to (almost certainly) fail: Building vs. buying your API infrastructureHow to (almost certainly) fail: Building vs. buying your API infrastructure
How to (almost certainly) fail: Building vs. buying your API infrastructure
 
API Design - 3rd Edition
API Design - 3rd EditionAPI Design - 3rd Edition
API Design - 3rd Edition
 
API Product Management - Driving Success through the Value Chain
API Product Management - Driving Success through the Value ChainAPI Product Management - Driving Success through the Value Chain
API Product Management - Driving Success through the Value Chain
 
Field Study 4 Episode 3
Field Study 4 Episode 3Field Study 4 Episode 3
Field Study 4 Episode 3
 

Similar to Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)

Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Atlassian
 
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Atlassian
 
OpenStack-Based NFV Cloud at Swisscom: challenges and best practices
OpenStack-Based NFV Cloud at Swisscom: challenges and best practicesOpenStack-Based NFV Cloud at Swisscom: challenges and best practices
OpenStack-Based NFV Cloud at Swisscom: challenges and best practicesAvi Networks
 
App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)jasonacooper
 
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...VMware Tanzu
 
2021 JCConf 使用Dapr簡化Java微服務應用開發
2021 JCConf 使用Dapr簡化Java微服務應用開發2021 JCConf 使用Dapr簡化Java微服務應用開發
2021 JCConf 使用Dapr簡化Java微服務應用開發Rich Lee
 
APIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good API
APIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good APIAPIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good API
APIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good APIapidays
 
Project Fedena and Why Ruby on Rails - ArvindArvind G S
Project Fedena and Why Ruby on Rails - ArvindArvind G SProject Fedena and Why Ruby on Rails - ArvindArvind G S
Project Fedena and Why Ruby on Rails - ArvindArvind G SThoughtWorks
 
eBay From Ground Level to the Clouds
eBay From Ground Level to the CloudseBay From Ground Level to the Clouds
eBay From Ground Level to the CloudsX.commerce
 
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...apidays
 
Kubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdfKubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdfAuliaFebrian2
 
Kubernetes for Java Developers
 Kubernetes for Java Developers Kubernetes for Java Developers
Kubernetes for Java DevelopersRed Hat Developers
 
JavaOne 2016: Kubernetes introduction for Java Developers
JavaOne 2016: Kubernetes introduction for Java Developers JavaOne 2016: Kubernetes introduction for Java Developers
JavaOne 2016: Kubernetes introduction for Java Developers Rafael Benevides
 

Similar to Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3) (20)

Document
DocumentDocument
Document
 
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
 
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
 
005281271.pdf
005281271.pdf005281271.pdf
005281271.pdf
 
OpenStack-Based NFV Cloud at Swisscom: challenges and best practices
OpenStack-Based NFV Cloud at Swisscom: challenges and best practicesOpenStack-Based NFV Cloud at Swisscom: challenges and best practices
OpenStack-Based NFV Cloud at Swisscom: challenges and best practices
 
Chapter2[one.]
Chapter2[one.]Chapter2[one.]
Chapter2[one.]
 
Chapter2 application
Chapter2 applicationChapter2 application
Chapter2 application
 
App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)
 
Week3 applications
Week3 applicationsWeek3 applications
Week3 applications
 
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
 
2021 JCConf 使用Dapr簡化Java微服務應用開發
2021 JCConf 使用Dapr簡化Java微服務應用開發2021 JCConf 使用Dapr簡化Java微服務應用開發
2021 JCConf 使用Dapr簡化Java微服務應用開發
 
APIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good API
APIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good APIAPIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good API
APIdays Paris 2018 - Autonomous APIs, Zdenek Nemec, Founder, Good API
 
Project Fedena and Why Ruby on Rails - ArvindArvind G S
Project Fedena and Why Ruby on Rails - ArvindArvind G SProject Fedena and Why Ruby on Rails - ArvindArvind G S
Project Fedena and Why Ruby on Rails - ArvindArvind G S
 
eBay From Ground Level to the Clouds
eBay From Ground Level to the CloudseBay From Ground Level to the Clouds
eBay From Ground Level to the Clouds
 
WEB API Gateway
WEB API GatewayWEB API Gateway
WEB API Gateway
 
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
 
Kubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdfKubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdf
 
How to Introduce Continuous Delivery
How to Introduce Continuous DeliveryHow to Introduce Continuous Delivery
How to Introduce Continuous Delivery
 
Kubernetes for Java Developers
 Kubernetes for Java Developers Kubernetes for Java Developers
Kubernetes for Java Developers
 
JavaOne 2016: Kubernetes introduction for Java Developers
JavaOne 2016: Kubernetes introduction for Java Developers JavaOne 2016: Kubernetes introduction for Java Developers
JavaOne 2016: Kubernetes introduction for Java Developers
 

More from Apigee | Google Cloud

Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs Apigee | Google Cloud
 
AccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First WorldAccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First WorldApigee | Google Cloud
 
Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?Apigee | Google Cloud
 
The Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management MarketThe Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management MarketApigee | Google Cloud
 
Managing the Complexity of Microservices Deployments
Managing the Complexity of Microservices DeploymentsManaging the Complexity of Microservices Deployments
Managing the Complexity of Microservices DeploymentsApigee | Google Cloud
 
Microservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices SuccessMicroservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices SuccessApigee | Google Cloud
 
Adapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet KapoorAdapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet KapoorApigee | Google Cloud
 
Adapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg BrailAdapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg BrailApigee | Google Cloud
 
Adapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant JhingranAdapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant JhingranApigee | Google Cloud
 
London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!Apigee | Google Cloud
 

More from Apigee | Google Cloud (20)

How Secure Are Your APIs?
How Secure Are Your APIs?How Secure Are Your APIs?
How Secure Are Your APIs?
 
Magazine Luiza at a glance (1)
Magazine Luiza at a glance (1)Magazine Luiza at a glance (1)
Magazine Luiza at a glance (1)
 
Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs
 
Apigee Demo: API Platform Overview
Apigee Demo: API Platform OverviewApigee Demo: API Platform Overview
Apigee Demo: API Platform Overview
 
Ticketmaster at a glance
Ticketmaster at a glanceTicketmaster at a glance
Ticketmaster at a glance
 
AccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First WorldAccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First World
 
Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?
 
Apigee Product Roadmap Part 2
Apigee Product Roadmap Part 2Apigee Product Roadmap Part 2
Apigee Product Roadmap Part 2
 
The Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management MarketThe Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management Market
 
Walgreens at a glance
Walgreens at a glanceWalgreens at a glance
Walgreens at a glance
 
Apigee Edge: Intro to Microgateway
Apigee Edge: Intro to MicrogatewayApigee Edge: Intro to Microgateway
Apigee Edge: Intro to Microgateway
 
Managing the Complexity of Microservices Deployments
Managing the Complexity of Microservices DeploymentsManaging the Complexity of Microservices Deployments
Managing the Complexity of Microservices Deployments
 
Pitney Bowes at a glance
Pitney Bowes at a glancePitney Bowes at a glance
Pitney Bowes at a glance
 
Microservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices SuccessMicroservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices Success
 
Adapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet KapoorAdapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet Kapoor
 
Adapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg BrailAdapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg Brail
 
Adapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant JhingranAdapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant Jhingran
 
London Adapt or Die: Opening Keynot
London Adapt or Die: Opening KeynotLondon Adapt or Die: Opening Keynot
London Adapt or Die: Opening Keynot
 
London Adapt or Die: Lunch keynote
London Adapt or Die: Lunch keynoteLondon Adapt or Die: Lunch keynote
London Adapt or Die: Lunch keynote
 
London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!
 

Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)

  • 1. Essential API Facade Patterns Episode 3 – One Phase to Two Phase Conversion Santanu Dey Apigee @Santanu_Dey @apigee
  • 6. Webcast Series: API Facade Patterns Episode 1 Composition Episode 2 Session Management Episode 3 One Phase to Two Phase Conversion Episode 4 Synchronous to Asynchronous
  • 7. Episode 3 : One-Phase to Two-Phase Conversion Problem Solution Benefits Considerations
  • 8. Problem How to expose a single phase API out of a two phase API To enable API teams and app developers to implement and improve their API designs and apps
  • 9. Problem From the point of view of the API provider, how to expose a single phase API out of a two phase API 1 One Phase Two Phase Consumer 2 Provider
  • 10. What is a Two Phase Interface?
  • 11. First Phase – Prepare (or Vote) Participating prepare Resource 1 prepare Participating Tx Coordinator Resource 2 prepare Participating Resource 3
  • 12. Second Phase - Commit Participating Resource 1 commit commit Participating Tx Coordinator Resource 2 commit Participating Resource 3
  • 13. Two phase commit works well for server-side distributed architecture
  • 14. Not such a good idea for an app to consume a two-phase API prepare Service App Provider commit
  • 15. Transaction reliability is seldom a requirement for a JavaScript plugin or an app
  • 16. Making the app a transaction coordinator is asking the developer to do too much - to think about roll back, compensation etc. -device runtime not well suited for heavy programming logic
  • 17. Problems with Service Composition on Device “chatty service” anti-pattern – multiple callouts from client app to multi services 1. Get user attributes 2. Get recommended topics API Provider 3. Get recommended books Client Network connection, negotiate security, data format & parsing
  • 18. Problems with Service Composition on Device Heavy data usage Too many network calls Battery drain Performance 1. Get user attributes 2. Get recommended topics API 3. Get recommended books Provider Client Network connection, negotiate security, data format & parsing
  • 20. One Phase to Two Phase Conversion using API Façade The solution is to introduce an API Façade in the middle which can handle the conversion 1 One Phase Two Phase Consumer 2 Provider
  • 21. One Phase to Two Phase Conversion using API Façade 1 One Phase Two Phase Consumer 2 Provider /reserve /payment
  • 22. One Phase to Two Phase Conversion using API Façade 1 One Phase Two Phase Consumer 2 Provider /payment
  • 24.
  • 25. If I am missing something, please let me know, but for now I consider ”REST transaction" to be an oxymoron. - Roy Fielding
  • 26. Example of the API Façade API Façade API Existing Backend Exposure & Capabilities Server Mgmt. App relies on REST
  • 29. The client app avoids complexities like managing transactions = Lovable API
  • 30. Distributed Transaction Management 1 Two Phase 2 Provider One Phase Consumer 1 Two Phase 2 Provider
  • 31. Resource states do not need to be maintained
  • 33. What is the trade-off? Ability to coordinate distributed transaction from the client
  • 34. Is it Possible to Expose Two-Phase API in REST?
  • 35. Here is an Example POST /transfer/transaction {”from":”account1”, ”to”:”account2”, "amount":100} Response: {"id":"/transfer/transaction/123", "state":”started", blah blah} PUT /transfer/transaction/123 {"id":"/transfer/transaction/123", "state":"committed", ...} Response: {"id":"/transfer/transaction/123", "state":”comitted", blah blah}
  • 37. THANK YOU Subscribe to API webcasts at: youtube.com/apigee Apigee @apigee
  • 38. THANK YOU Questions and ideas to: groups.google.com/group/api-craft Apigee @apigee
  • 39. THANK YOU Contact me at: @Santanu_Dey sdey@apigee.com Apigee @apigee

Editor's Notes

  1. I am Santanu DeyI am a senior solution architect here at Apigee – I am focused on Integration – primarily API based Integration & and a little bit beyond
  2. As an API Provider we often come across a situation where the backend core system exposes a 2 phase Interface – for simplicity of consumption we have to convert it to one phase REST APIWHY DO WE WANT TO DO THIS?The essence of API integration over enterprise style integration is extra emphasis on simplicity. So if it makes it easy for a Developer to consume the API – lets better make it simple.Traditionally Enterprise systems expose interfaces compatible with 2 phase commit. 2 phase commit is a very well established pattern. This is very useful for designing transactions in a reliable way. But these are not so appropriate for the edge of the enterprise. Where innovation is driven by ease of consumption of resources. The underlying enterprise integration tools should not dictate how APIs are defined, exposed and integrated. That is the core motivation for this pattern.
  3. It is common for backend Interfaces running on enterprise integration software exposes a two phase interface. From the perspective of the distributed transactions – when an Interface supports two phase commit we can say it is a two phase API
  4. A quick and high-level recap how a typical tow phase transaction work in the distributed transaction scenario– there are two types of resources. A transaction coordinator or a transaction Manager. And then the participating resources.At the core of two phase distributed transaction - each participating resource supports two phases – to be able to participate in a distributed two phase transaction.How does it all happen?Prepare or vote - A “commit” vote means that participants can carry out the commit if told to – there is no inconsistency or exception expected from that component
  5. Commit or Rollback. In this phase, the transaction coordinator instructs each of the participating resourcesto commit or rollback all of the changes that were requested as part of the transaction. A properly executed rollback should return the system to its original state.A commit should result into a consistent state of change across systems.
  6. This makes a lot of sense for machine to machine communication in a distributed architectureIn order to reliably carry out distributed transactions – this is a great pattern. A two phase commit that is. But the key question is that is it a good idea for an app to consume a two phase enabled API?
  7. I think it is not a good idea for an app to consume a two phase API interface.It is like getting an app to become a transaction coordinator because the API provider supports two phase it is not a great ideaFirst of all When looking into REST one of the first things probably anybody will notice is there isn't any transaction semantics defined. Unlike WS-Transactions for web services.Let us see why it does not sound like a good idea
  8. The important one is this –Consider a typical appA browser plugin may be written in java script, an app running on a device or an HTML 5 need have Transactional behavior? Let me emphasize more on the use case in question. Not so much on the technology employed. Are there any real use cases?Let us think about a two phase API example. Thinking about transactions – payment comes in mind. Consider GSMA OneAPI Payment API – the mobile payment API - Yes it has two phases. But in most scenarios – the Developer server is expected to make the calls. So it is a machine to machine architecture. Not a client application to API host.
  9. Secondly, making the app a transaction coordinator is kind of forcing the developer to think about roll back, compensation etc.The device run-time is not best suited for heavy logic needed for a two phase commit, roll back or compensationLack of simplicity in the APIs would make it difficult for the developer
  10. The Service Composition pattern in Episode 1 listed the other disadvantages of composing multiple service calls from the device – this situation also applies to this case. At least partially here the connections are to the same server….
  11. let us assume that the backend has a two phase interface- > Reserve an amount for payment- > Commit the paymentOne of the ways to convert this interface to REST kind of semantics is to just convert the resources to two appropriate corresponding APIs. Like I have shown in the slide. And yes – there would be a way to get the payment resource location as a representation in the reserve response. But this is still away from REST for the problems sighted in the problem segment of our discussion.
  12. So the suggested pattern is to not to get influenced by what the backend API signature looks likeThe API Façade should still expose a single resource
  13. UML sequence diagram to explain the responsibilities of the API Façade layer in this pattern.Point to note that the transaction management responsibility has shifted to the API façade The client has to only deal with one resource and one pure REST call.What I have not shown here is that the API façade also can do a bunch of things when the transaction go wrong. And at the end just throw a much simpler error back to the client.
  14. We are not recommending a two phase REST API or “transactional REST APIs”
  15. The Façade is a logical construct in terms of the architecture. It can be implemented by number of software components such as Application servers, databases, API management & exposure layer, analytics and so on. The good news is that the Façade Layer does not need to rebuild all the existing capabilities. The API Service Layer is a Façade on top of the existing capabilities. I wanted to make it clear that we show this layer as a single component – but that is just a logical representation.
  16. If the API provider has EAI style two phase interfaces – using this pattern those can be re-used for exposing through the edge of the enterprise for the partners and consumers outside the organization.Backend does not need to changeOff-late we are seeing that the API programs are also opening up internal integration opportunities. Remember the “eat your own dog food” phrase? So even internal consumers who prefers REST over EAI should be able to consume the services through this pattern.
  17. The second benefit is ease of use. Once we are truly REST it is much easier for the consumer to use an APIThe client deals with one resource at a time, instead of attempting to be a transaction manager of a sort.The responsibilities of transaction management if at all, is deferred to the API Façade.I am not even highlighting the other standard benefits of moving the composition responsibilities into the Façade – lower network calls from device, lower processing and all that. But let us look at the transaction management angle
  18. This is an extended example of the same pattern – Here the api façade is responsible for coordinating a distributed transaction. However exposes only a single REST resource for the client.So the API façade takes care of the transaction roll back and compensation scenarios as well.Instead of looking for a "transaction protocol" over REST and HTTP, we should consider a resource that is acting as a coordinator. The client can then ask that coordinator resource do manage changes across those other resources atomically or in whatever manner makes sense for the application. The façade exposes the resource coordinators as REST resources themselvesAs far as the client is concerned, it is not aware of any distributed transaction protocol. There more complexities than just transaction management The backends may require security protocols that are not expensive for an AppThere may be rules associated with transaction timeout, rollback that the Façade can take care of
  19. If we had exposed two phase API through the API Façade the Façade layer then had to maintain resource lock and resource stateThis leads to better performance and scalability of the Façade layer itself.Being freed from client specific state management the Façade layer can scale well.
  20. What do we give up while taking this approach?If the use case really warrants a reliable kind of transaction management – REST may not be a good choice. But there are some examples are coming up on exposing REST APIs with transactional behaviour..
  21. This is still a semantics – to support REST format transaction – The detail is in implementation and real world use casesThat is something that still can be brainstormed. With this food for thought I will conclude