SlideShare une entreprise Scribd logo
1  sur  13
Télécharger pour lire hors ligne
Consumer Driven Contracts
Qaiser Mazhar
$ whoami
● Scrum Master for Baskets & Checkouts
● Joined M&S in March
Previous Life
● Tech Lead & Agile Coach at Rightmove.co.uk
● Search Replacement (Odin)
● Property Data
● Helping other teams and individuals become more “agile”
Odin
● Microservices
○ Restful API, JSON over http
○ Java 8, Springboot
○ High quality, clean code
○ Healthy coverage (we did not chase percentage) - Spock, Wiremock, Mockito, AssertJ, Rest-
assured, Gatling, Spring Integration/Web-Integration etc...
○ ELK
○ Monitoring - Xymon, Dashing.io, Spring Health/Metrics, NewRelic
○ Resilience - Hystrix, 3 Site Architecture, Load Balancer
○ ...
● Frontend
○ Mobile first
○ Hand built components
○ Non-isomorphic
Odin
● High performing team
○ Autonomy
○ Support what we built
○ Right tool for the job
○ Clear standards and best practices
■ Living documents
○ Strong opinions, loosely held
○ All the DDs (ATDD, BDD, TDD, DDD)
○ CI/CD
○ Promiscuous Pragmatic Pair Programming
○ Sociocratic decision making process
Odin
● Challenges
○ Large Team (~12 Devs, 2 QAs, Team Lead, Tech Lead)
○ Lots of learning
■ It's ok to fail as long as there are learnings
○ Lots to do
■ Rearchitecture, CD, Mobile first responsive UI, Agile practices
○ Onboarding new developers
■ Better documentation?
○ Supporting non-CD Teams
○ Breaking changes in APIs
Consumer Driven Contracts
● Traditional end to end Tests (Dependency driven)
○ Too late to get feedback
○ Expensive to change so late
○ Difficult to orchestrate
■ Your client might not exist yet
○ Don’t know who is using your software
● Consumer Driven
○ APIs that provide value (and be beautiful )
○ Fail fast
○ Confidence in decommissions
○ Independent deployments
○ Improve communication/collaboration with dependent teams
How does it work?
● Centralised contract storage
○ Publish contracts each build
○ Golden source of client dependencies
○ Download and test each build
○ Test both consumer and provider against contract
● A Service can be both provider and consumer
● Frameworks can help:
○ Realestate.com.au pact
○ Thoughtworks pacto
● Stub Provider Service
○ Testing service not downstream
○ Spring @Profile annotation
Creating a new endpoint
1. Consumer identifies a need from a provider that is currently not available.
2. Consumer collaborates with service provider to define API to satisfy consumer’s
needs whilst considering the constraints and considerations of the provider.
Result is a contract that the provider must abide by.
3. Provider implements the API to honour the contract, whilst still satisfying all
other existing contracts.
4. Provider runs an automated test to verify the contract has been satisfied as far as
the API is concerned. Functionality is tested via Unit, Integration and other
appropriate tests.
5. Provider publishes changes.
6. Consumer publishes contract and consumes new provider API.
Creating a new endpoint
Consumer ProducerPACT
Consumer ProducerPACT
Consumer ProducerPACT
Updating existing endpoint
1. Consumer identifies a change to an existing endpoint for a provider.
2. Consumer collaborates with service provider and any other existing consumers to define API that
will satisfy all consumer’s needs whilst considering the constraints and considerations of the
provider. Result is a contract that the provider must abide by.
3. Provider implements the API to honour the contract, whilst still satisfying all other existing
contracts.
4. Provider runs an automated test to verify the contract has been satisfied as far as the API is
concerned. Functionality is tested via Unit, Integration and other appropriate tests.
5. Provider publishes changes.
6. Consumer publishes new contract, removes old redundant contract and consumes updated
provider API.
7. Remaining consumers publish new contracts, remove redundant contracts and consume updated
provider API.
8. Provider removes deprecated API.
Updating existing endpoint
Consumer ProducerPACT
Consumer ProducerPACT
Consumer ProducerPACT
Consumer ProducerPACT
Too much of a good thing..
● CDCs has most value when working with other teams with independent release
cycles
○ Limited when all consumers ever are in the same small team
● Overhead when rapidly changing API
● Single point of failure for CDC Repository
○ Pick somewhere robust - nexus?
● CDCs can be abused
○ Too loose of a contract
○ Not updated
○ Testing returned values
● CDCs enable conversations, not replace
Other Stuff
● Postels Law
● API Versioning
○ Keep only a couple API versions and clean them up
○ Contract with Consumers that only N versions will be supported so they must update regularly
● Rollbacks are more robust
● Discover and Test APIs
○ Swagger/Spring fox
○ README.md
○ Be consistent - don’t make me think

Contenu connexe

Tendances

Design and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice ArchitectureDesign and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice Architecture
Lohika_Odessa_TechTalks
 
API First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipelineAPI First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipeline
Pronovix
 

Tendances (20)

Contract testing. Isolated testing of microservices with pact.io - Evgeniy Ku...
Contract testing. Isolated testing of microservices with pact.io - Evgeniy Ku...Contract testing. Isolated testing of microservices with pact.io - Evgeniy Ku...
Contract testing. Isolated testing of microservices with pact.io - Evgeniy Ku...
 
Collaborative Contract Driven Development
Collaborative Contract Driven DevelopmentCollaborative Contract Driven Development
Collaborative Contract Driven Development
 
vodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pactvodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pact
 
Fed London - January 2015
Fed London - January 2015Fed London - January 2015
Fed London - January 2015
 
Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
 
Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021
 
Implementing BDD at scale for agile and DevOps teams
Implementing BDD at scale for agile and DevOps teamsImplementing BDD at scale for agile and DevOps teams
Implementing BDD at scale for agile and DevOps teams
 
Design and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice ArchitectureDesign and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice Architecture
 
Effective API Lifecycle Management
Effective API Lifecycle Management Effective API Lifecycle Management
Effective API Lifecycle Management
 
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
 
API Design Collaboration
API Design CollaborationAPI Design Collaboration
API Design Collaboration
 
Process
ProcessProcess
Process
 
Contract Testing
Contract TestingContract Testing
Contract Testing
 
Consumer Driven Contracts
Consumer Driven ContractsConsumer Driven Contracts
Consumer Driven Contracts
 
How to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJSHow to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJS
 
Contract Testing: An Introduction
Contract Testing: An IntroductionContract Testing: An Introduction
Contract Testing: An Introduction
 
API First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipelineAPI First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipeline
 
Consumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With PostmanConsumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With Postman
 
ATAGTR2017 Testing of Connected Cars Based on IOT
ATAGTR2017 Testing of Connected Cars Based on IOTATAGTR2017 Testing of Connected Cars Based on IOT
ATAGTR2017 Testing of Connected Cars Based on IOT
 
Contract testing | Евгений Кузьмин | CODEiD
Contract testing | Евгений Кузьмин | CODEiDContract testing | Евгений Кузьмин | CODEiD
Contract testing | Евгений Кузьмин | CODEiD
 

Similaire à Microservices: Consumer Driven Contracts in Practice

Similaire à Microservices: Consumer Driven Contracts in Practice (20)

Testing microservices, contract testing
Testing microservices, contract testingTesting microservices, contract testing
Testing microservices, contract testing
 
LF Energy Webinar: Introduction to TROLIE
LF Energy Webinar: Introduction to TROLIELF Energy Webinar: Introduction to TROLIE
LF Energy Webinar: Introduction to TROLIE
 
MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021
 
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
 
Integration testing with PACT
Integration testing with PACTIntegration testing with PACT
Integration testing with PACT
 
Consumer driven Contract Test
Consumer driven Contract TestConsumer driven Contract Test
Consumer driven Contract Test
 
Consumer contract testing
Consumer contract testingConsumer contract testing
Consumer contract testing
 
Big ideas in small packages - How microservices helped us to scale our vision
Big ideas in small packages  - How microservices helped us to scale our visionBig ideas in small packages  - How microservices helped us to scale our vision
Big ideas in small packages - How microservices helped us to scale our vision
 
Monitoring SLA with Prometheus and LibreOffice Calc
Monitoring SLA with Prometheus and LibreOffice CalcMonitoring SLA with Prometheus and LibreOffice Calc
Monitoring SLA with Prometheus and LibreOffice Calc
 
Hyperledger fabric 3
Hyperledger fabric 3Hyperledger fabric 3
Hyperledger fabric 3
 
Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
 
Ledingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionLedingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in action
 
Deployability
DeployabilityDeployability
Deployability
 
Agile 101
Agile 101Agile 101
Agile 101
 
LPC User Requirements for Automated Storage System Presentation
LPC User Requirements for Automated Storage System PresentationLPC User Requirements for Automated Storage System Presentation
LPC User Requirements for Automated Storage System Presentation
 
A multi sided marketplace platform for telco enabled products Werner Eriksen
A multi sided marketplace platform for telco enabled products Werner EriksenA multi sided marketplace platform for telco enabled products Werner Eriksen
A multi sided marketplace platform for telco enabled products Werner Eriksen
 
Behaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileBehaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibile
 
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
 
Why You Should Be Doing Contract-First API Development
Why You Should Be Doing Contract-First API DevelopmentWhy You Should Be Doing Contract-First API Development
Why You Should Be Doing Contract-First API Development
 
Spring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureSpring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice Architecture
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Microservices: Consumer Driven Contracts in Practice

  • 2. $ whoami ● Scrum Master for Baskets & Checkouts ● Joined M&S in March Previous Life ● Tech Lead & Agile Coach at Rightmove.co.uk ● Search Replacement (Odin) ● Property Data ● Helping other teams and individuals become more “agile”
  • 3. Odin ● Microservices ○ Restful API, JSON over http ○ Java 8, Springboot ○ High quality, clean code ○ Healthy coverage (we did not chase percentage) - Spock, Wiremock, Mockito, AssertJ, Rest- assured, Gatling, Spring Integration/Web-Integration etc... ○ ELK ○ Monitoring - Xymon, Dashing.io, Spring Health/Metrics, NewRelic ○ Resilience - Hystrix, 3 Site Architecture, Load Balancer ○ ... ● Frontend ○ Mobile first ○ Hand built components ○ Non-isomorphic
  • 4. Odin ● High performing team ○ Autonomy ○ Support what we built ○ Right tool for the job ○ Clear standards and best practices ■ Living documents ○ Strong opinions, loosely held ○ All the DDs (ATDD, BDD, TDD, DDD) ○ CI/CD ○ Promiscuous Pragmatic Pair Programming ○ Sociocratic decision making process
  • 5. Odin ● Challenges ○ Large Team (~12 Devs, 2 QAs, Team Lead, Tech Lead) ○ Lots of learning ■ It's ok to fail as long as there are learnings ○ Lots to do ■ Rearchitecture, CD, Mobile first responsive UI, Agile practices ○ Onboarding new developers ■ Better documentation? ○ Supporting non-CD Teams ○ Breaking changes in APIs
  • 6. Consumer Driven Contracts ● Traditional end to end Tests (Dependency driven) ○ Too late to get feedback ○ Expensive to change so late ○ Difficult to orchestrate ■ Your client might not exist yet ○ Don’t know who is using your software ● Consumer Driven ○ APIs that provide value (and be beautiful ) ○ Fail fast ○ Confidence in decommissions ○ Independent deployments ○ Improve communication/collaboration with dependent teams
  • 7. How does it work? ● Centralised contract storage ○ Publish contracts each build ○ Golden source of client dependencies ○ Download and test each build ○ Test both consumer and provider against contract ● A Service can be both provider and consumer ● Frameworks can help: ○ Realestate.com.au pact ○ Thoughtworks pacto ● Stub Provider Service ○ Testing service not downstream ○ Spring @Profile annotation
  • 8. Creating a new endpoint 1. Consumer identifies a need from a provider that is currently not available. 2. Consumer collaborates with service provider to define API to satisfy consumer’s needs whilst considering the constraints and considerations of the provider. Result is a contract that the provider must abide by. 3. Provider implements the API to honour the contract, whilst still satisfying all other existing contracts. 4. Provider runs an automated test to verify the contract has been satisfied as far as the API is concerned. Functionality is tested via Unit, Integration and other appropriate tests. 5. Provider publishes changes. 6. Consumer publishes contract and consumes new provider API.
  • 9. Creating a new endpoint Consumer ProducerPACT Consumer ProducerPACT Consumer ProducerPACT
  • 10. Updating existing endpoint 1. Consumer identifies a change to an existing endpoint for a provider. 2. Consumer collaborates with service provider and any other existing consumers to define API that will satisfy all consumer’s needs whilst considering the constraints and considerations of the provider. Result is a contract that the provider must abide by. 3. Provider implements the API to honour the contract, whilst still satisfying all other existing contracts. 4. Provider runs an automated test to verify the contract has been satisfied as far as the API is concerned. Functionality is tested via Unit, Integration and other appropriate tests. 5. Provider publishes changes. 6. Consumer publishes new contract, removes old redundant contract and consumes updated provider API. 7. Remaining consumers publish new contracts, remove redundant contracts and consume updated provider API. 8. Provider removes deprecated API.
  • 11. Updating existing endpoint Consumer ProducerPACT Consumer ProducerPACT Consumer ProducerPACT Consumer ProducerPACT
  • 12. Too much of a good thing.. ● CDCs has most value when working with other teams with independent release cycles ○ Limited when all consumers ever are in the same small team ● Overhead when rapidly changing API ● Single point of failure for CDC Repository ○ Pick somewhere robust - nexus? ● CDCs can be abused ○ Too loose of a contract ○ Not updated ○ Testing returned values ● CDCs enable conversations, not replace
  • 13. Other Stuff ● Postels Law ● API Versioning ○ Keep only a couple API versions and clean them up ○ Contract with Consumers that only N versions will be supported so they must update regularly ● Rollbacks are more robust ● Discover and Test APIs ○ Swagger/Spring fox ○ README.md ○ Be consistent - don’t make me think