Insert Example
Overview
Complete Flow Architecture
POST Request → Controller → Service → PreBus Plugins → Command Handler → RESTClient → External System
↓
Response ← Controller ← Service ← Command Handler ← RESTClient ← External SystemDetailed Flow Breakdown
1. POST Request
↓
2. Controller (API Entry Point)
↓
3. Service Layer (Business Orchestration)
↓
4. PreBus Processing (Validation Pipeline)
├── AddToShippingSequence (Plugin Registration)
├── AddToShippingDataPacket (Validation Context)
└── ValidateShipping Plugin (Business Rules)
↓
5. Command Handler (RESTClient Integration)
├── Internal DTO → Request DTO Mapping
├── RESTClient Call to External System
└── Response DTO Processing
↓
6. Event Publishing (Asynchronous Processing)
↓
7. Subscribers (Side Effects)Step-by-Step Implementation
1. API Controller - The Entry Point
2. Service Layer - Business Orchestration
2.1. PreBus Business Rule Sequence - Validation Pipeline
2.2. PreBus Data Packet - Validation Context
2.3. PreBus Validation Plugin - Business Rules
2.4. PreBus Plugin Benefits
3. Command Handler - RESTClient Integration
4. NServiceBus Handler - Message Processing
6. Event Publishing - Asynchronous Processing
7. RESTClient Integration - External Communication
7.1. Request DTO - External Contract
7.2. Response DTO - External Contract
7.3. Mapping Configuration - DTO Transformation
8. Event Subscribers - Side Effects
Data Transfer Objects (DTOs)
Internal DTOs - Application Contracts
Input DTO: AddToShippingDto
AddToShippingDtoCommand: AddToShippingCommand
AddToShippingCommandExternal DTOs - External System Contracts
Request DTO: AddToShippingRequestDto
AddToShippingRequestDtoResponse DTO: AddToShippingResponseDto
AddToShippingResponseDtoDTO Mapping Relationships
Flow Summary
Synchronous Flow (Immediate Response)
Asynchronous Flow (Event Processing)
External Communication Flow
Key Benefits
Last updated