In a monolithic application, different services are developed within same project side by side.
In these kind of applications you don't need to worry about breaking the compatibility between contract interfaces since there is an invisible verifier called compiler that checks that all method calls follows the defined signature.
But in case of microservices, different services are deployed in different runtimes and using different separated networks.
In this scenario, any change on the contract of one service cannot be caught by the compiler since there is no typesafe connection between services..
Now breaking the compatibility between services can be really easy and hard to detect (maybe until your new version of the service is on production).
In this talk we are going to explore why deploying a new version of a service might break everything in microservices architecture, and how to fix with consumer-driven contracts pattern.
Video recording: https://2017.javazone.no/program/87956decfb9c467ab4f3bef24cee5064
30. @alexsotob
Advantages Disadvantages
Unit Tests (and Mocks)
10
Cheap
No setup of environment
Fast
Mocks
Reliable
All local, no flaky
Not Trustworthy
How you understand the system
Targeted
You know where it failed
42. @alexsotob
> Provider Contracts
provider centric, consumers adapts all or nothing
> Consumer Contracts
individual consumer’s needs
Ownership
Different Approaches
16
43. @alexsotob
> Provider Contracts
provider centric, consumers adapts all or nothing
> Consumer Contracts
individual consumer’s needs
> Consumer-driven Contracts
representation of a provider's obligations to all its consumers
Ownership
Different Approaches
16
61. @alexsotob20
> Pact Foundation
Pact specification v3
> Integration with several languages
JVM, Ruby, Python, Go, .Net, Swift, JS
> Pact Broker
Sharing contracts, API documentation, Overview of services
62. @alexsotob20
> Pact Foundation
Pact specification v3
> Integration with several languages
JVM, Ruby, Python, Go, .Net, Swift, JS
> Pact Broker
Sharing contracts, API documentation, Overview of services
> Arquillian Algeron
Arquillian ecosystem + Pact, Publishers/Retrievers, JBoss Forge
67. @alexsotob
> Execute Build
Publish contracts as artefact version
> Run Head Provider Contract Tests
Check contract compatibility against version contract
Deploying Consumer
Steps on CI (Commit Stage)
23
68. @alexsotob
> Execute Build
Publish contracts as artefact version
> Run Head Provider Contract Tests
Check contract compatibility against version contract
> Run Prod Provider Contract Tests
Check contract compatibility against version contract
Deploying Consumer
Steps on CI (Commit Stage)
23
69. @alexsotob
> Execute Build
Publish contracts as artefact version
> Run Head Provider Contract Tests
Check contract compatibility against version contract
> Run Prod Provider Contract Tests
Check contract compatibility against version contract
> Release Consumer
Tag contract with environment name
Deploying Consumer
Steps on CI (Commit Stage)
23
72. @alexsotob
> Execute Build
Run as usual
> Run Provider Contract Tests
Check contract compatibility against latest contract
Deploying Provider
Steps on CI (Commit Stage)
24
73. @alexsotob
> Execute Build
Run as usual
> Run Provider Contract Tests
Check contract compatibility against latest contract
> Run Prod Provider Contract Tests
Check contract compatibility against environment contract
Deploying Provider
Steps on CI (Commit Stage)
24
74. @alexsotob
> Execute Build
Run as usual
> Run Provider Contract Tests
Check contract compatibility against latest contract
> Run Prod Provider Contract Tests
Check contract compatibility against environment contract
> Release Provider
Deploying Provider
Steps on CI (Commit Stage)
24
79. @alexsotob
Conclusions
27
> End To End Tests
Late feedback
Expensive change
Difficult to orchestrate
> Consumer Driven Contracts
Fail fast
Independent deployments
Improve communication