Technical Breakdown
1. Database Schema (Flyway Migrations - fluxx-sql-server repo)
A. Job Table
- Create
[extractor].[Job]table - Include:
JobID,FileId,ClientApplicationExtractorIDStatus,StatusMessage,ExtractorResponsePollAttemptCount,LastPollAttemptAtIsActive,CreatedAt,UpdatedAt,CompletedAt
- Add FK constraints to
[file].[File]and[registration].[ClientApplicationExtractor]
B. JobStatus Table
- Create
[extractor].[JobStatus]table - Include:
JobStatusID,JobID,Status,MessageAttemptNumber,Timestamp
- Add FK constraint to
[extractor].[Job]
2. Registration Service
A. Endpoint
- Create
GET /registration/:clientAppId/extractors- Returns list of active extractors for a client application
B. Schema and Response DTO
- Use
ClientApplicationExtractorIDandExtractionUrl - Ensure
IsActive = truefilter is enforced
C. Swagger/OpenAPI
- Document new route and schema in OpenAPI spec
3. Extractor Service - Infrastructure Setup
A. SQL Access
- Add SQL connector for
[extractor]schema - Enable read/write access to
JobandJobStatustables
B. Key Vault Integration
- Configure secret retrieval:
- Secret name =
ClientApplicationExtractorID - Value = API key for
ExtractionUrl
- Secret name =
C. Blob Storage Access
- Add write capability to blob container with HNS enabled
- Use folder path:
4. Extractor Service - Job Lifecycle Logic
A. FileAccepted Handler
- Consume
TOPIC_ACCEPTED_FILE - Parse message and retrieve:
ClientApplicationID,FileID
- Call Registration API to get extractors
- Select first extractor
B. Job Initialization
- Generate
JobID - Retrieve API key from Key Vault
- Create
Jobrecord in DB withStatus = Queued - Publish
JobQueuedmessage to Service Bus
C. Submit Job
- Retrieve file from blob storage
- Send API request to
ExtractionUrlwithjobIdandfileUrl - Update
Jobstatus toStarted - Insert status record into
JobStatus
5. Polling and Result Handling
A. Polling Logic
- If polling is required:
- Periodically call
{pollingUrl}/{jobId} - Store status in
JobStatuswith attempt count and timestamp - Update main
Jobstatus fields and poll counters
- Periodically call
B. Finalization
- On job completion (success or failure):
- Store result JSON in blob storage under expected path
- Update
Jobrecord with final status andCompletedAt - Publish
JobSucceededorJobFailedmessage to Service Bus
6. Status Messaging (Extractor Service)
- Publish messages to
TOPIC_JOB_STATUSfor:JobQueuedJobStartedJobSucceededJobFailed
- Ensure message schema is aligned with Status service expectations
7. Internal API for Status Querying (Extractor Service)
- Create endpoints:
GET /extractor/job/:jobIdGET /extractor/job/file/:fileId
- Response includes:
- Current status
- Result blob path
- History of status changes (from
JobStatus)