Skip to content

znsio/specmatic-kafka-sample

Folders and files

NameName
Last commit message
Last commit date
Aug 4, 2024
Jun 5, 2024
Jun 5, 2024
Sep 2, 2024
Jan 31, 2025
Jun 5, 2024
Aug 5, 2024
Jan 31, 2025
Sep 2, 2024
Jan 31, 2025
Jun 5, 2024
Jun 5, 2024
Jun 5, 2024
Aug 7, 2024

Repository files navigation

Specmatic Kafka Sample

This sample project demonstrates how we can run contract tests against a service which interacts with a kafka broker.

NOTE: This project uses AsyncAPI 2.6 specification. For equivalent sample project that uses AsyncAPI 3.0 spec please refer to specmatic-kafka-sample-asyncapi3.

Background

This project includes a consumer that listens to messages on a specific topic. Upon receiving a message, the consumer processes it and publishes a new message to two other designated topics.

Specmatic Kafka Sample Architecture

Pre-requisites

  • Gradle
  • JDK 17+
  • Docker

Run the tests

./gradlew clean test

Run the contract tests using specmatic-kafka docker image

  1. Start the kafka broker using below command.
    docker compose up
  2. Run the application.
    ./gradlew bootRun
  3. Run the contract tests.
    docker run --network host -v "$PWD/specmatic.yaml:/usr/src/app/specmatic.yaml" -v "$PWD/src/test/resources:/usr/src/app/examples" -v "$PWD/build/reports:/usr/src/app/build/reports" znsio/specmatic-kafka-trial:0.22.13 test --examples=examples

Get information around other CLI args exposed by specmatic-kafka docker image

  1. To get information around all the CLI args of the virtualize command, run the following.
     docker run znsio/specmatic-kafka-trial virtualize --help
  2. To get information around all the CLI args of the test command, run the following.
     docker run znsio/specmatic-kafka-trial test --help

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages