SlideShare a Scribd company logo
Coordinating APIs with Spring
Cloud Contract
omri.spector@develeap.com
About me
• Omri Spector, CTO deveLeap
• deveLeap mission
– Helping development teams use the right tools,
technologies & architecture to achieve their business
objective.
– Specialize in Java, DevOPS and the JVM eco-system
• Omri
– Active commercial developer since 1985
– In Java since 2004
– Managed large multi national development groups
omri.spector@develeap.com
Agenda
• Introduction
– The challenge
– CDC Answer
• Demo – Spring Cloud Contract
• Wrap up - workflows
Lets start with a bedtime story
omri.spector@develeap.com
PM Has a new and exciting feature
omri.spector@develeap.com
Two teams are involved
Producer (“Server”) Consumer(“Client”)
omri.spector@develeap.com
So they discuss the feature
(And the API. Sort of.)
omri.spector@develeap.com
Each writes their own end
omri.spector@develeap.com
They even write tests
omri.spector@develeap.com
And all is green
omri.spector@develeap.com
Deploy to real environment
omri.spector@develeap.com
omri.spector@develeap.com
What Happened?
• Each side had a “copy” of the contract
• Each side wrote it’s own tests, so it was always
green
• But in reality…
– Different URL, Different queue
– Different structure
– Different data type
– Different headers
– :
omri.spector@develeap.com
Why are we talking with ghosts?
• Because you can’t wait for the other team
• Because you can’t start the whole damn
system all the time
• Because it is hard to find issues with all the
system up
omri.spector@develeap.com
But what if we wrote WSDL?
• AND we did NOT copy it, of course
• API Schemas come with another set of
challenges:
– Strict beyond need of specific customer
– Server owned by definition
• Who said server team is available?
• How do we get them to write a nice API?
omri.spector@develeap.com
And this gets worse over time
• Server needs to evolve, and so do the server
APIs – are we maintaining the contract?
• When can we drop an API? A field?
• Can we fix a typo?
• And what happens if we change a header?
Encoding?
omri.spector@develeap.com
Enter Micro-Services
• A whole new world of trouble:
– Many producer-consumer pairs
– Complex environment to spin
– The service breaking the
contract, is not the one
that fails
omri.spector@develeap.com
So Our Challenge Is
• We don’t want to require E2E testing as the
basic validation
• We must avoid multiple copies of contract
• We suffer when tests & stubs are written
together hiding real integration
• We want to avoid strict contracts that limit the
server and impose un-needed detail on the
client
In graphic form the problem is
actually very clear
omri.spector@develeap.com
Integration Use Case
Consumer Producer
Controller logic Controller logic
omri.spector@develeap.com
Unit Testing is not Enough
Consumer Producer
Controller logic Controller logic
Unit
Test
Stub
Unit
Test Stub
NOT
ALIGNED
omri.spector@develeap.com
SCC To The Rescue
Consumer Producer
Controller logic Controller logic
Unit
Test
Stub
Unit
Test Stub
Artifact Repo
Contract
Generate Generate
Demonstration
Stop talking. Start Doing.
Sources of demonstration on GitHub:
Producer - https://github.com/ospector/jj2017-scc-producer
Consumer - https://github.com/ospector/jj2017-scc-consumer
omri.spector@develeap.com
The Benefits of SCC
• Contracts as artifact
– Versioned with the product
– Shared, re-usable
• Stub validity
– Server verified to stick to contracts
– Client receives updates if server changes
• Enables Consumer-oriented, lean API design
omri.spector@develeap.com
Consumer Driven Contracts
• Ownership:
– Contracts are owned by their consumers
– Contracts relate to the part that interests the
consumer, not to the whole API
– APIs are owned by producers, but subject to contracts
• Versioning
– Contracts relate directly to producer version
• Validation:
– Contracts are checked as part of every build
– Contracts generate both stubs and tests
– Checks are two way, based on a single contract
omri.spector@develeap.com
An SCC CDC Workflow
Consumer
• Clones producer
• In own code - TDDs feature
• In producer code - Writes contract
• Rinse & repeat until happy with contract
• PR
• Move to repo based stubs
Producer
• Takes over PR
• Implements API (not necessarily logic)
• Merge & release
omri.spector@develeap.com
Contract Repository
• In some cases we may prefer to put all
contracts in a third repository
– Centralizes all contracts in a system
– “Protects” code from other teams
omri.spector@develeap.com
Standalone Stubs
• SCC can also run stubs as a standalone
application
• This is good for:
– Non-Java clients
– Smoke testing End-to-end
Thank you!
www.develeap.com
Contact: omri.spector@develeap.com

More Related Content

PPTX
Reactive Micro Services with Java seminar
PPTX
What’s expected in Spring 5
ODP
Developing Microservices using Spring - Beginner's Guide
PPTX
Multi-threading in the modern era: Vertx Akka and Quasar
PPTX
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
PPTX
Asynchronous programming in ASP.NET
PPTX
Java Colombo: Developing Highly Scalable Apps
PDF
New in Spring Framework 5.0: Functional Web Framework
Reactive Micro Services with Java seminar
What’s expected in Spring 5
Developing Microservices using Spring - Beginner's Guide
Multi-threading in the modern era: Vertx Akka and Quasar
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
Asynchronous programming in ASP.NET
Java Colombo: Developing Highly Scalable Apps
New in Spring Framework 5.0: Functional Web Framework

What's hot (20)

PPTX
ASP.NET vNext
PDF
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
PPTX
How to build a SaaS solution in 60 days
PPTX
Java 8 concurrency abstractions
PDF
Alfresco Transform Service DevCon 2019
 
PDF
Securing Containers From Day One | null Ahmedabad Meetup
PPTX
Angular Owin Katana TypeScript
PDF
Event Driven Architecture with Apache Camel
PPTX
JavaEE Microservices platforms
PPT
Docker in the Cloud
PPTX
MVC 6 - the new unified Web programming model
PDF
Akka and Kubernetes: Reactive From Code To Cloud
PDF
Zeppelin meetup 2016 madrid
PDF
Microservices with Java, Spring Boot and Spring Cloud
PPTX
Grails with swagger
PPTX
Setting Up Development Environment For Google App Engine & Python | Talentica
PPTX
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
PPTX
ASP.Net 5 and C# 6
ODP
Spring cloud for microservices architecture
PDF
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
ASP.NET vNext
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
How to build a SaaS solution in 60 days
Java 8 concurrency abstractions
Alfresco Transform Service DevCon 2019
 
Securing Containers From Day One | null Ahmedabad Meetup
Angular Owin Katana TypeScript
Event Driven Architecture with Apache Camel
JavaEE Microservices platforms
Docker in the Cloud
MVC 6 - the new unified Web programming model
Akka and Kubernetes: Reactive From Code To Cloud
Zeppelin meetup 2016 madrid
Microservices with Java, Spring Boot and Spring Cloud
Grails with swagger
Setting Up Development Environment For Google App Engine & Python | Talentica
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
ASP.Net 5 and C# 6
Spring cloud for microservices architecture
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
Ad

Similar to Coordinating Micro-Services with Spring Cloud Contract (20)

PDF
How to Build Front-End Web Apps that Scale - FutureJS
PDF
Fed London - January 2015
PDF
Mobile Code Optimisation Services
PDF
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
PDF
Service api design validation & collaboration
PPTX
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
PPTX
Mule ESB Intro
PDF
Patterns and practices for building enterprise-scale HTML5 apps
PPTX
Continuous Deployment to the cloud
PDF
NetWork - 15.10.2011 - Applied code generation in .NET
PDF
Continuous Deployment of your Application @SpringOne
PPT
How to design effective APIs
PDF
Continuous Deployment of your Application @JUGtoberfest
PPTX
10 Reasons You MUST Consider Pattern-Aware Programming
PDF
Designing your API Server for mobile apps
PDF
CarTrawler's Feature Team Architecture and Development Process Showcase by Lu...
PDF
AngularJSTO presentation
PDF
Next Generation Architecture Showcase July 2019
PPTX
Application Architecture
PPTX
Angular js
How to Build Front-End Web Apps that Scale - FutureJS
Fed London - January 2015
Mobile Code Optimisation Services
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Service api design validation & collaboration
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
Mule ESB Intro
Patterns and practices for building enterprise-scale HTML5 apps
Continuous Deployment to the cloud
NetWork - 15.10.2011 - Applied code generation in .NET
Continuous Deployment of your Application @SpringOne
How to design effective APIs
Continuous Deployment of your Application @JUGtoberfest
10 Reasons You MUST Consider Pattern-Aware Programming
Designing your API Server for mobile apps
CarTrawler's Feature Team Architecture and Development Process Showcase by Lu...
AngularJSTO presentation
Next Generation Architecture Showcase July 2019
Application Architecture
Angular js
Ad

Recently uploaded (20)

PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Nekopoi APK 2025 free lastest update
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Transform Your Business with a Software ERP System
PPTX
Operating system designcfffgfgggggggvggggggggg
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
medical staffing services at VALiNTRY
PDF
Complete Guide to Website Development in Malaysia for SMEs
Reimagine Home Health with the Power of Agentic AI​
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Salesforce Agentforce AI Implementation.pdf
Oracle Fusion HCM Cloud Demo for Beginners
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Odoo Companies in India – Driving Business Transformation.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Nekopoi APK 2025 free lastest update
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Designing Intelligence for the Shop Floor.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Transform Your Business with a Software ERP System
Operating system designcfffgfgggggggvggggggggg
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Digital Systems & Binary Numbers (comprehensive )
medical staffing services at VALiNTRY
Complete Guide to Website Development in Malaysia for SMEs

Coordinating Micro-Services with Spring Cloud Contract

Editor's Notes

  • #24: Docs: All: https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html DSL: https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html#_contract_dsl