Slide 1

Slide 1 text

Contract-Driven Development for Event-Driven Architectures Hari Krishnan and Joel Rosario

Slide 2

Slide 2 text

Hari Krishnan Co-Founder, CTO at Specmatic [email protected] @harikrishnan83 Transformation Advisor Coach and Trainer API Governance Strategist Joel Rosario Co-Founder, Chief Scientist at Specmatic [email protected] @finalprefix Consultant and coach Agile software development Contract Driven Development

Slide 3

Slide 3 text

© 2024 All Rights Reserved Architecture of our System Under Test Order Service place-order process-order cancel-order process-cancellation Request Reply Request Reply

Slide 4

Slide 4 text

© 2024 All Rights Reserved Live Demo Contract testing with AsyncAPI 2.6 (convention-based Request Reply pattern)

Slide 5

Slide 5 text

© 2024 All Rights Reserved Migrating from AsyncAPI 2.6 to 3.0 • Native support ”request-reply” pattern • Define “correlationId” • Support for dynamic reply topic • And more

Slide 6

Slide 6 text

© 2024 All Rights Reserved How do we migrate safely? Without introducing unintended change in behavior

Slide 7

Slide 7 text

Automated Spec vs Spec Compatibility Check 3.0.0 2.6.0 Contract Test Mock (In-memory / persistent Kafka Broker) Request Message Reply Message

Slide 8

Slide 8 text

© 2024 All Rights Reserved Running Contract Tests Using the 3.0.0 spec to run contract test against service implementation

Slide 9

Slide 9 text

© 2024 All Rights Reserved Contract Test Setup Contract as Test Request Reply API (System under Test) Consumer Business Logic Topics Offset validation Payload schema Counts API-Specification.yaml Payload validation Producer Send Verify Request Reply Send Verify Receive Topic request Send Topic reply Send Topic reply Receive Topic request Example Data

Slide 10

Slide 10 text

© 2024 All Rights Reserved Live Demo Using the 3.0.0 spec to run contract test for “request-reply“ pattern

Slide 11

Slide 11 text

© 2024 All Rights Reserved Mock based on v3.0.0 spec Allow applications integrating with our service make independent progress

Slide 12

Slide 12 text

© 2024 All Rights Reserved Mocking 3.0.0 Mock (In-memory Kafka Broker) Receive Topic request Send Topic reply Send Topic reply Receive Topic request Payload validation Examples 3.0.0 Contract Test

Slide 13

Slide 13 text

© 2024 All Rights Reserved Importance of Example Validation Slide by Frank Kilcommins - https://www.linkedin.com/in/frank-kilcommins/

Slide 14

Slide 14 text

© 2024 All Rights Reserved Contract Driven Development API Governance in a nutshell

Slide 15

Slide 15 text

© 2024 All Rights Reserved Contract Driven Development – API Governance in a nutshell Consumer Provider API Design First • Shift Left all the way to Design • Reduced time-to-market due to Parallel Development • Enhanced DevEx with improved Collaboration • Resilient API Building Blocks

Slide 16

Slide 16 text

Thanks! Hari Krishnan and Joel Rosario