{"id":47693829,"url":"https://github.com/specmatic/specmatic-ibm-mq-sample","last_synced_at":"2026-04-02T16:11:40.313Z","repository":{"id":348146023,"uuid":"1165506163","full_name":"specmatic/specmatic-ibm-mq-sample","owner":"specmatic","description":"Sample project that demonstrates how you can contract test your IBM MQ based service using Specmatic","archived":false,"fork":false,"pushed_at":"2026-03-31T00:30:28.000Z","size":75,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-31T03:53:40.684Z","etag":null,"topics":["async","ibmmq","sample-project"],"latest_commit_sha":null,"homepage":"https://docs.specmatic.io/supported_protocols/asyncapi/ibm-mq","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/specmatic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-24T08:36:30.000Z","updated_at":"2026-03-31T00:30:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/specmatic/specmatic-ibm-mq-sample","commit_stats":null,"previous_names":["specmatic/specmatic-ibm-mq-sample"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/specmatic/specmatic-ibm-mq-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-ibm-mq-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-ibm-mq-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-ibm-mq-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-ibm-mq-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/specmatic","download_url":"https://codeload.github.com/specmatic/specmatic-ibm-mq-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-ibm-mq-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31309712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["async","ibmmq","sample-project"],"created_at":"2026-04-02T16:11:39.666Z","updated_at":"2026-04-02T16:11:40.306Z","avatar_url":"https://github.com/specmatic.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# specmatic-ibm-mq-sample\n\nCross-platform sample project that implements the async workflow described in `spec/spec.yaml` using IBM MQ.\n\n## What it does\n\nQueues from the spec are implemented as IBM MQ local queues:\n\n- `new.orders` -\u003e consumes `OrderRequest`, publishes `Order` to `wip.orders`\n- `to.be.cancelled.orders` -\u003e consumes `CancelOrderRequest`, publishes `CancellationReference` to `cancelled.orders`\n- `out.for.delivery.orders` -\u003e consumes `OutForDelivery` and updates in-memory order status\n- `accepted.orders` -\u003e published when the HTTP `PUT /orders` API is called\n\nMessage payloads are JSON, and the optional header `orderCorrelationId` is preserved on produced messages.\n\n## Tech stack (why this is cross-platform)\n\n- Java 21 + Spring Boot 3 (runs on macOS, Linux, Windows)\n- IBM MQ Java client (`com.ibm.mq.allclient`) which avoids OS-specific native client setup\n- Docker Compose for local IBM MQ broker (same startup command across OSes)\n\n## Prerequisites\n\n- Java 21\n- Gradle (or use the included Gradle wrapper)\n- Docker Desktop / Docker Engine with Compose\n\n## Architecture\n\n- Spring Boot app with JMS listeners for `new.orders`, `to.be.cancelled.orders`, and `out.for.delivery.orders`\n- IBM MQ broker in Docker (queue manager `QM1`)\n- HTTP API for accepting orders (`PUT /orders`) and checking status (`GET /orders/{id}`)\n- In-memory `OrderStateStore` to track the latest order status and update time\n\n## Contract tests\n\nRun the Specmatic contract tests in Docker:\n\n```bash\n./scripts/run-contract-tests.sh\n```\n\nThis uses `docker-compose.test.yaml`, starts IBM MQ, the app, and Specmatic, streams live logs only from `specmatic-test`, then returns the Specmatic exit code.\nThe stack is left running for debugging; use the cleanup script to tear down.\n\nTo show logs for all containers after the run, set `SHOW_ALL_LOGS=1`:\n\n```bash\nSHOW_ALL_LOGS=1 ./scripts/run-contract-tests.sh\n```\n\nDirect compose command (same behavior):\n\n```bash\ndocker compose -f docker-compose.test.yaml up --abort-on-container-exit --exit-code-from specmatic-test\n```\n\nCleanup (stop/remove containers and volumes):\n\n```bash\n./scripts/cleanup-contract-tests.sh\n```\n\n## What happens in the contract tests\n\n- Specmatic publishes a `new.orders` message and expects a `wip.orders` message.\n- Specmatic calls `PUT /orders` (before fixture) and expects an `accepted.orders` message with the same payload.\n- Specmatic publishes a `to.be.cancelled.orders` message and expects a `cancelled.orders` message.\n- Specmatic publishes an `out.for.delivery.orders` message and verifies order status via `GET /orders/{id}?status=SHIPPED` (after fixture).\n\n## Debugging test failures\n\n- Check the Specmatic container logs: `docker compose -f docker-compose.test.yaml logs -f specmatic-test`\n- Check the app logs for listener/validation errors: `docker compose -f docker-compose.test.yaml logs -f app`\n- Check IBM MQ logs if messages are not flowing: `docker compose -f docker-compose.test.yaml logs -f ibm-mq`\n- If HTTP fixtures fail, confirm the app is reachable at `http://sut:8080` from the Specmatic container.\n- Use the message count report from Specmatic to confirm which queue is missing messages.\n\n## Run the app manually\n\n1. Start IBM MQ:\n\n```bash\ndocker compose up -d\n```\n\nApple Silicon (`arm64`) note:\n\n- IBM MQ's official container is currently `amd64` only.\n- This project sets `platform: linux/amd64` in `docker-compose.yml`, so Docker Desktop runs it using emulation.\n- If Docker still fails on macOS ARM, enable Docker Desktop x86/amd64 emulation (Rosetta/QEMU support), then retry.\n\n2. Start the app:\n\n```bash\n./gradlew bootRun\n```\n\nThe app starts an HTTP server on port `8080` and connects to IBM MQ at `localhost:1415` (matching `spec/spec.yaml`).\n\n3. Test the API:\n\n```bash\ncurl -i -X PUT http://localhost:8080/orders \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"id\":123,\"status\":\"ACCEPTED\",\"timestamp\":\"2025-04-12T14:30:00Z\"}'\n\ncurl -i http://localhost:8080/orders/123?status=ACCEPTED\n```\n\n## Easy smoke test (recommended)\n\nRun this in a second terminal while the app is running:\n\n```bash\n./gradlew bootRun --args=\"--app.smoke-test.enabled=true --spring.jms.listener.auto-startup=false\"\n```\n\nShortcut scripts:\n\n- macOS/Linux: `sh scripts/smoke-test.sh`\n- Windows PowerShell: `powershell -ExecutionPolicy Bypass -File scripts/smoke-test.ps1`\n\nWhat it does:\n\n- Publishes a sample `new-orders` message\n- Waits for `accepted-orders`\n- Publishes a sample cancel request\n- Waits for `cancelled-orders`\n- Publishes an `out-for-delivery-orders` message\n- Exits with status `0` on success / `1` on failure\n\n## Unit tests\n\n```bash\n./gradlew test\n```\n\nThese test the core message-processing logic without needing IBM MQ.\n\n## Queue and connection defaults\n\n- Queue manager: `QM1`\n- Channel: `DEV.APP.SVRCONN`\n- Username: `app`\n- Password: `passw0rd`\n- Host port mapping: `1415 -\u003e 1414` (container MQ listener)\n\n## Notes\n\n- IBM MQ container startup can take a little time on first run.\n- On ARM machines (for example Apple Silicon Macs), IBM MQ runs under `amd64` emulation in Docker.\n- The sample uses simple logging and an in-memory status store; replace with a database if you need persistence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecmatic%2Fspecmatic-ibm-mq-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspecmatic%2Fspecmatic-ibm-mq-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecmatic%2Fspecmatic-ibm-mq-sample/lists"}