Skip to content

fix(#12): Add Camel OpenAPI REST client example with Citrus server simulation - #20

Merged
christophd merged 1 commit into
mainfrom
feature/12-camel-openapi-client
Jul 21, 2026
Merged

christophd merged 1 commit into
mainfrom
feature/12-camel-openapi-client

Conversation

@christophd

Copy link
Copy Markdown
Member

Summary

Closes #12

Adds a new example module demonstrating the reverse of the existing pattern:

  • The Quarkus/Camel application uses the component as an HTTP client to call an external Petstore service, driven from an OpenAPI specification
  • Citrus acts as the simulated HTTP server, validating each incoming request against the OpenAPI spec and generating schema-compliant responses

What's included

File Purpose
PetstoreClientRoutes.java Four Camel routes triggered via direct: endpoints, each invoking a Petstore operation via rest-openapi:petstore-api.json#<operationId>
PetstoreOpenApiClientTest.java Citrus @HttpServerConfig-managed server on port 18080; uses openapi().server().receive() / .send() to validate requests and generate responses
petstore-api.json Trimmed Petstore spec (no basePath variable) so paths resolve directly as /pet and /pet/{petId}
application.properties petstore.service.url property placeholder pointing to the Citrus test server
README.md Full walkthrough of the pattern, architecture, and key concepts

Key implementation notes

  • Uses Camel property placeholder {{petstore.service.url}} (not Java string concatenation) so the host is resolved correctly at runtime
  • POST/PUT routes include marshal().json() to serialise the body before the outbound HTTP call
  • All Camel route invocations use the Citrus async() container to avoid deadlocks between the Camel HTTP producer thread and the Citrus main test thread
  • Added citrus-validation-text dependency to handle GET/DELETE (bodyless) request validation contexts

Test results

Full reactor build also passes: mvn clean install -DskipTests — all 19 modules green.

Generated by Bob via /oss-fix-issue

@christophd
christophd force-pushed the feature/12-camel-openapi-client branch from e461d77 to 4d11758 Compare July 21, 2026 09:23
@christophd
christophd merged commit 67a7557 into main Jul 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Camel OpenAPI REST client example with Citrus OpenAPI server simulation

1 participant