Slide 1

Slide 1 text

Consumer Driven Contracts with Spring Cloud Contract

Slide 2

Slide 2 text

Disclaimer Presentations are intended for educational purposes only and not to replace independent professional judgment. The views and opinions expressed in this presentation do not necessarily reflect the official policy or position of blibli.com. Audience discretion is advised.

Slide 3

Slide 3 text

Who Am I? • Alex Xandra Albert Sim • Principal R&D Engineer at blibli.com • [email protected] • bertzzie(.sim)

Slide 4

Slide 4 text

The Hype MICROSERVICES!

Slide 5

Slide 5 text

Our Current System • Hundreds of microservices • All on the JVM, except UIs and Mobile • Most are on Spring Framework

Slide 6

Slide 6 text

How do services talk to each other? Service Client A Client B Client C Interface

Slide 7

Slide 7 text

Provider Contract • The service defines the interface, everyone use it • Close and complete • Singular and authoritative • (Usually) stable and immutable

Slide 8

Slide 8 text

The Microservice Problem • Managing Changes • How are people using my service(s)? • Stubs / Mocks. TONS of it. • Release Engineering requires 5 PHDs, 3 geniuses, and 1 Norse God • Short Release Cycle and Continuous Delivery only available in Wakanda • QA L

Slide 9

Slide 9 text

Enter Consumer Driven Contract Service Client A Client B Client C Data A Data B

Slide 10

Slide 10 text

Consumer Contract • Consumers define their interfaces to the service • There’s still conventions and limits (duh) • Open and incomplete • Multiple and non-authoritative • (Usually) stable and immutable

Slide 11

Slide 11 text

Consumer Driven Contract - How does it work? Source: http://servicedesignpatterns.com/WebServiceEvolution/ConsumerDrivenContracts 1 2 3 4

Slide 12

Slide 12 text

Consumer Driven Contract - How does it work? 1. Each consumer write their executable tests 2. Producer reviews and approves the tests written 3. Producer test against the tests and make sure it all passes PS. The test could be on separate repo or on producer’s

Slide 13

Slide 13 text

Why Consumer Driven? • Service providers now know how their service is used • Evolving the service is easier • Could be easily integrated to CI / CD systems • Better confidence in each release • No more manual stub / less mocks

Slide 14

Slide 14 text

Further Reading • https://martinfowler.com/articles/consumerD rivenContracts.html • http://cloud-samples.spring.io/spring-cloud- contract-samples/workshops.html

Slide 15

Slide 15 text

Thank You