enrichment schema 2
This commit is contained in:
42
plan-extended-anaylis/advanced_context.md
Normal file
42
plan-extended-anaylis/advanced_context.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Advanced Context Extraction: Payloads and Interceptors
|
||||
|
||||
## 1. Incoming Payload Analysis
|
||||
To understand *what* data drives the state machine, we need to capture metadata about the incoming parameters at entry points.
|
||||
|
||||
### REST Endpoints
|
||||
For methods annotated with `@PostMapping`, `@PutMapping`, etc.:
|
||||
1. **Extract Parameters**: Scan method parameters for `@RequestBody`, `@PathVariable`, or `@RequestParam`.
|
||||
2. **Type Extraction**: Capture the FQN of the parameter type (e.g., `com.example.OrderRequest`).
|
||||
3. **Data Linkage**: If a field from this payload is used in a `sendEvent(payload.getEvent())` call, mark the transition as "Dynamic based on Payload".
|
||||
|
||||
### Message Listeners
|
||||
For `@RabbitListener` or `@JmsListener`:
|
||||
1. Identify the parameter receiving the message body.
|
||||
2. Extract its type and any `@Header` or `@Payload` annotations.
|
||||
|
||||
## 2. Interceptor and Filter Analysis
|
||||
Interceptors often perform cross-cutting logic (authentication, context injection) that affects how state machines are driven.
|
||||
|
||||
### Discovery Strategy
|
||||
1. **Find Interceptors**: Scan for classes implementing `HandlerInterceptor` or `WebRequestInterceptor`.
|
||||
2. **Registration Mapping**: Look for `WebMvcConfigurer.addInterceptors()` calls to identify which URL patterns each interceptor applies to.
|
||||
3. **Context Injection**: Analyze if the interceptor modifies the request (e.g., `request.setAttribute("userContext", ...)`) or populates a `ThreadLocal` (like `SecurityContextHolder`).
|
||||
|
||||
### Linking to State Machines
|
||||
If a controller uses a value from a known Interceptor-injected context to decide which event to send or which state machine to restore, we can link the Interceptor's logic to the State Machine flow.
|
||||
|
||||
## 3. Implementation in `EnrichmentService`
|
||||
We will introduce a `ContextEnricher` that:
|
||||
1. Builds a map of **Active Interceptors** per path.
|
||||
2. Augments `EntryPoint` metadata with **Payload Type** information.
|
||||
|
||||
## 4. Modeling Updates
|
||||
Update `EntryPoint` and `TriggerPoint` to include `payloadType` and `interceptors`.
|
||||
|
||||
```java
|
||||
public record EntryPoint(
|
||||
// ... existing fields ...
|
||||
String payloadType,
|
||||
List<String> activeInterceptors
|
||||
) {}
|
||||
```
|
||||
Reference in New Issue
Block a user