[Code Update - Chapter 11] Code update for MP Rest Client 4.0#73
Open
ttelang wants to merge 10 commits into
Open
[Code Update - Chapter 11] Code update for MP Rest Client 4.0#73ttelang wants to merge 10 commits into
ttelang wants to merge 10 commits into
Conversation
with '#' will be ignored, and an empty message aborts the commit.
Unpinned installs were pulling newer alpha versions of @antora/pdf-extension that call contentCatalog.createFile, a method not present in Antora 3.1.10, causing a fatal build failure.
- Changed HTTP and HTTPS ports in payment service from 9080/9081 to 9050/9051. - Added server.xml configuration for payment service with MicroProfile 7.1 and Jakarta EE 10.0 features. - Created README.adoc for shipment service detailing its functionality, technologies, and API endpoints. - Deleted outdated README.md for shipment service. - Updated liberty-maven-plugin version to 3.11.2 in shipment service. - Refactored ShipmentResource path from "/api/shipments" to "/shipments". - Added server.xml configuration for shipment service with MicroProfile 7.1 and Jakarta EE 10.0 features. - Created README.adoc for shopping cart service outlining its features and API endpoints. - Deleted outdated README.md for shopping cart service. - Updated liberty-maven-plugin version to 3.11.2 in shopping cart service. - Refactored CatalogClient and InventoryClient to enable fault tolerance features. - Updated ShoppingCartHealthCheck to implement health checks for liveness and readiness. - Added server.xml configuration for shopping cart service with MicroProfile 7.1 and Jakarta EE 10.0 features. - Updated User Management Service README.adoc to reflect changes in MicroProfile and Jakarta EE versions. - Updated liberty-maven-plugin version to 3.11.2 in user service. - Added server.xml configuration for user service with MicroProfile 7.1 and Jakarta EE 10.0 features.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: Code Update for MicroProfile Rest Client 4.0
Overview
This PR updates Chapter 11 of the MicroProfile tutorial to demonstrate the latest features of MicroProfile Rest Client 4.0 alongside Jakarta EE 10 and MicroProfile 7.1. The changes include comprehensive code examples, extensive documentation, and new service implementations showcasing best practices for building type-safe REST clients in microservices architectures.
Key Updates
MicroProfile Rest Client 4.0 Features Demonstrated
1. New
baseUri(String)Convenience MethodURI.create()wrapperInventoryServicefor programmatic client creation2. CDI Integration with
@RestClient@RestClientqualifier for CDI injection3. AutoCloseable Support
AutoCloseableRestClientBuilder📝 Code Examples
REST Client Interface (
ProductClient.java)@RegisterRestClientannotation@RegisterProviderfor custom exception mappingException Handling (New Files)
ProductNotFoundException.java- Checked exception (404 responses)ServiceUnavailableException.java- Unchecked exception (503 responses)ProductServiceResponseExceptionMapper.java- Maps HTTP errors to custom exceptionsCustom Filters (New Filter Classes)
BearerTokenFilter.java- Authentication via Bearer tokensCorrelationIdFilter.java- Distributed tracing with correlation IDsRequestLoggingFilter.java- Comprehensive request loggingResponseLoggingFilter.java- Response logging with status trackingProductClientWithFilters.java- Client with all filters registeredService Classes
ProductCatalogService.java- CDI-injected REST client usageProductClientBuilderService.java- Programmatic client creation examplesFilteredProductCatalogService.java- Service using filtered clientsREST Resource (
ProductCatalogResource.java)Documentation Enhancements
The
README.adocnow includes extensive sections:curlcommands for testingUse Cases Covered
Technology Stack Upgrades
Testing Guidance
Quick Start:
Testing Endpoints:
GET /catalog/products,GET /catalog/products/{id}GET /catalog/builder/products,GET /catalog/builder/products/{id}/dynamicGET /catalog/filtered/products,GET /catalog/compare/{id}