[Code Update - Chapter 11] Code update for MP Rest Client 4.0#73
Open
ttelang wants to merge 7 commits into
Open
[Code Update - Chapter 11] Code update for MP Rest Client 4.0#73ttelang wants to merge 7 commits into
ttelang wants to merge 7 commits into
Conversation
with '#' will be ignored, and an empty message aborts the commit.
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}