MokuLakshithReddy opened a new pull request, #149:
URL: https://github.com/apache/fineract-consumer-facing/pull/149

   ## Description
   This PR resolves #66 by implementing end-to-end correlation ID support 
across both the frontend and backend of Apache Fineract Consumer Facing.
   
   ### Summary of Changes:
   1. **Header Constants**:
      - Added `CORRELATION_ID = "X-Correlation-ID"` constant to 
`ConsumerHeaders` (infrastructure/web) and `FineractHeaders` 
(infrastructure/fineractclient).
   2. **Backend**:
      - `CorrelationIdHolder`: A request-scoped holder to store and access the 
correlation ID during the lifecycle of an HTTP request.
      - `CorrelationIdFilter`: A `OncePerRequestFilter` registered in 
`SecurityConfig` (before `BearerTokenAuthenticationFilter`) that extracts 
incoming `X-Correlation-ID` or generates a new `UUID.randomUUID()`. It 
populates `CorrelationIdHolder`, slf4j `MDC` with key `"correlationId"`, sets 
the response header `X-Correlation-ID`, and ensures clean removal in a 
`finally` block.
      - `FineractCorrelationIdInterceptor`: A Feign `RequestInterceptor` 
registered in `FineractClientConfig` that forwards `X-Correlation-ID` from 
`CorrelationIdHolder` to downstream Apache Fineract Core API calls.
   3. **Frontend**:
      - `correlationIdInterceptor`: An Angular HTTP interceptor 
(`HttpInterceptorFn`) that sets `X-Correlation-ID` header on all outgoing 
`/api` requests (preserving any pre-existing correlation ID if present).
      - Registered `correlationIdInterceptor` in `app.config.ts`.
   4. **Tests**:
      - Unit tests added for `CorrelationIdHolderTest`, 
`FineractCorrelationIdInterceptorTest`, and `CorrelationIdFilterTest`.
      - Unit tests added for frontend `correlation-id.interceptor.spec.ts`.
   
   Closes #66
   
   Signed-off-by: Moku Lakshith Reddy <[email protected]>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to