{"id":22772311,"url":"https://github.com/pactflow/example-provider-java-kafka","last_synced_at":"2025-07-30T12:05:11.085Z","repository":{"id":42520941,"uuid":"271538963","full_name":"pactflow/example-provider-java-kafka","owner":"pactflow","description":"Example Java Kafka Producer","archived":false,"fork":false,"pushed_at":"2025-07-02T09:51:26.000Z","size":361,"stargazers_count":6,"open_issues_count":1,"forks_count":16,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-02T10:46:37.783Z","etag":null,"topics":["example"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pactflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-11T12:20:34.000Z","updated_at":"2025-07-02T09:51:28.000Z","dependencies_parsed_at":"2024-11-07T16:33:47.969Z","dependency_job_id":"a8e5719a-a124-4d1d-b8eb-77f3244f9793","html_url":"https://github.com/pactflow/example-provider-java-kafka","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pactflow/example-provider-java-kafka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-java-kafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-java-kafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-java-kafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-java-kafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pactflow","download_url":"https://codeload.github.com/pactflow/example-provider-java-kafka/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-java-kafka/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267865821,"owners_count":24157343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example"],"created_at":"2024-12-11T17:08:03.741Z","updated_at":"2025-07-30T12:05:11.059Z","avatar_url":"https://github.com/pactflow.png","language":"Java","readme":"# Example Java Kafka Producer\n\n![Build](https://github.com/pactflow/example-provider-java-kafka/workflows/Build/badge.svg)\n\n[![Can I deploy Status](https://testdemo.pactflow.io/pacticipants/pactflow-example-provider-java-kafka/branches/master/latest-version/can-i-deploy/to-environment/production/badge)](https://testdemo.pactflow.io/pacticipants/pactflow-example-provider-java-kafka)\n\n![Pact Status](https://testdemo.pactflow.io/pacts/provider/pactflow-example-provider-java-kafka/consumer/pactflow-example-consumer-java-kafka/latest/badge)(latest pact)\n\n![Pact Status](https://testdemo.pactflow.io/pacts/provider/pactflow-example-provider-java-kafka/consumer/pactflow-example-consumer-java-kafka/latest/master/badge) (master/master pact)\n\n\nThis is an example of a Java Spring Boot Kafka Producer that uses Pact, [PactFlow](https://pactflow.io) and GitHub Actions to ensure that it is compatible with the expectations its consumers have of it.\n\nSee the canonical provider example here: https://github.com/pactflow/example-provider\nSee also the full [PactFlow CI/CD Workshop](https://github.com/pactflow/ci-cd-workshop) for which this can be substituted in as the \"provider\".\n\nIn the following diagram, we'll be testing the \"Event API\", a service that publishes product events to a Kafka stream on the `product` topic.\n\n![Kafka Architecture](docs/kafka.png \"Kafka Architecture\")\n\n## Pre-requisites\n\n**Software**:\n\n* Tools listed at: https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/prerequisites/\n* Java (17+)\n* A pactflow.io account with an valid [API token](https://docs.pactflow.io/docs/getting-started/#configuring-your-api-token)\n\n### Environment variables\n \nTo be able to run some of the commands locally, you will need to export the following environment variables into your shell:\n\n* `PACT_BROKER_TOKEN`: a valid [API token](https://docs.pactflow.io/docs/getting-started/#configuring-your-api-token) for PactFlow\n* `PACT_BROKER_BASE_URL`: a fully qualified domain name with protocol to your pact broker e.g. https://dius.pactflow.io\n* `PACT_BROKER_HOST`: a fully qualified domain name _without_ protocol to your pact broker e.g. dius.pactflow.io\n\n## Usage\n\n* Running tests: `./gradlew clean test`\n* Start a Kafka cluster, and setup the producer endpoint (enables `POST` to `localhost:8081/products`): `make start`\n* Create a new event (manually):\n\n    ```\n    curl -X POST -H\"Content-Type: application/json\" localhost:8081/products -d '{\n      \"id\": \"7e54c13c-e28e-41fc-b34d-99de62db4666\",\n      \"name\": \"Unbranded Plastic Tuna\",\n      \"type\": \"BACON\",\n      \"event\": \"UPDATED\",\n      \"version\": \"v1\"\n    }'\n    ```\n\nTo disable test data generation that puts random events onto `product` topic, prefix with `SEND_TEST_EVENTS=false`. e.g. `SEND_TEST_EVENTS=false make start`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-provider-java-kafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpactflow%2Fexample-provider-java-kafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-provider-java-kafka/lists"}