Forms Builder - Domain Events & Integration Contracts
Domain events emitted by the Forms Builder context, integration contracts, and asynchronous downstream reactions across enterprise systems.
Domain Events & Integration Contracts
The Forms Builder bounded context interacts with surrounding enterprise systems strictly through published domain events and formal integration contracts. This decoupled, asynchronous architecture allows downstream operational domains (Workflow, CRM, ERP, Analytics) to react to newly submitted business data without creating synchronous web request dependencies or blocking user form completion.
1. Domain Events Emitted
The following table catalogs the core domain events emitted across the lifecycles of form blueprints, schemas, draft sessions, and finalized submissions:
| Event Name | Source Aggregate | Emitted When | Conceptual Payload Highlights |
|---|---|---|---|
FormBlueprintCreated | FormBlueprint | Administrator registers a new form concept in the platform. | BlueprintId, BlueprintCode, Title, Category, OwnerId, CreatedAt. |
FormSchemaDraftCreated | FormSchemaVersion | A new draft version is instantiated (new form or cloned from prior version). | SchemaVersionId, BlueprintId, VersionNumber, ClonedFromVersionId, AuthorId. |
FormSchemaPublished | FormSchemaVersion | A schema version passes DAG cycle verification and is promoted to active. | SchemaVersionId, BlueprintId, VersionNumber, ActiveFieldKeysList, PublishedTimestamp. |
FormSchemaDeprecated | FormSchemaVersion | A previously active schema version is superceded by a newly published release. | SchemaVersionId, BlueprintId, VersionNumber, SupercededByVersionId, Timestamp. |
FormSchemaArchived | FormSchemaVersion | A schema version is permanently retired and blocked from taking any submissions. | SchemaVersionId, BlueprintId, VersionNumber, ArchivedReason, Timestamp. |
FormDraftSessionStarted | SubmissionDraftSession | A respondent opens an active form and initiates a stateful session. | DraftSessionId, SchemaVersionId, SubmitterContext, SessionToken, ExpiresAt. |
FormDraftStepSaved | SubmissionDraftSession | User triggers progressive autosave or advances to the next step. | DraftSessionId, CurrentStepIndex, AnswerKeysUpdatedList, AutosavedAt. |
FormDraftSessionExpired | SubmissionDraftSession | An unsubmitted draft session surpasses its retention window without completion. | DraftSessionId, SchemaVersionId, SubmitterContext, ExpiredAt. |
FormSubmissionReceived | FormSubmission | User commits final submission; payload enters the authoritative validation queue. | SubmissionId, BlueprintId, SchemaVersionId, SubmitterContext, ReceivedAt. |
FormSubmissionValidated | FormSubmission | Server-side validation passes; answer map is sealed with an SHA-256 hash. | SubmissionId, BlueprintId, SchemaVersionId, ValidatedAnswerMap, ResponseHash, Timestamp. |
FormSubmissionRejected | FormSubmission | Server validation fails due to type mismatch, regex breach, or unfulfilled mandatory field. | SubmissionDraftId, SchemaVersionId, ViolatingFieldErrorsList, RejectedAt. |
FormSubmissionProcessed | FormSubmission | Downstream consumers (ERP/Workflow) acknowledge processing the submission. | SubmissionId, ConsumerDomain, TargetEntityReferenceId, ProcessedAt. |
FormQuotaExhausted | FormBlueprint | Total completed submissions reaches the blueprint’s MaxSubmissionsAllowed. | BlueprintId, TotalSubmissionsRecorded, ExhaustedAt. |
FormExpiredTriggered | FormBlueprint | Current time surpasses the blueprint’s scheduled ExpirationTimestamp. | BlueprintId, ExpirationTimestamp, ClosedAt. |
FormSubmissionExported | FormSubmission | Tabular projection generated for bulk reporting or analytical data lake ingestion. | BlueprintId, SchemaVersionId, SubmissionCountExported, ExportFormat, Timestamp. |
2. Integration Contracts & Asynchronous Reactions
Downstream enterprise systems subscribe to Forms Builder domain events via message brokers:
flowchart TD
FORMS["Forms Builder Domain"]
E1["FormSubmissionValidated"]
E2["FormDraftSessionExpired"]
E3["FormQuotaExhausted"]
E4["FormSchemaPublished"]
FORMS --> E1
FORMS --> E2
FORMS --> E3
FORMS --> E4
E1 -->|Launch Approval & Task Assignment| BPMN["Workflow & BPMN Engine"]
E1 -->|Ingest Structured Intake Records| ERP["ERP & CRM Domains"]
E1 -->|Stream Flattened Records| LAKE["Data Lake & Analytics"]
E2 -->|Purge Temporary Unlinked Uploads| STORAGE["Object Storage Cleaner"]
E3 -->|Send Administrative Capacity Alert| NOTIFY["Notification Engine"]
E4 -->|Invalidate Edge Cache & CDN| CDN["Edge Application Gateway"]
1. Workflow & BPMN Engine Reaction
- Subscribed Event:
FormSubmissionValidated - Reaction:
- The workflow engine evaluates business routing rules mapped to the
BlueprintCode. - Spawns a new workflow instance (e.g., launching an Employee Expense Approval Process or Vendor Onboarding Case).
- Binds the
SubmissionIdandResponseHashas immutable process variables.
- The workflow engine evaluates business routing rules mapped to the
- Responsibility Boundary: Forms Builder guarantees valid, tamper-evident answers; the Workflow Engine manages managerial assignments, deadlines, escalation timers, and approval decisions.
2. ERP & Operational Domain Reaction (CRM / Procurement / HR)
- Subscribed Event:
FormSubmissionValidated - Reaction:
- An enterprise adapter translates the
ValidatedAnswerMapinto internal domain commands. - Example: A customer intake form response triggers
RegisterNewCustomerAccountwithin CRM. - Example: A physical asset damage form triggers
CreateMaintenanceWorkOrderin Field Services. - Returns a confirmation event publishing
FormSubmissionProcessedback to the Forms Builder for lineage audit tracking.
- An enterprise adapter translates the
- Responsibility Boundary: Forms Builder is completely unaware of ERP database schemas; translation occurs via the external adapter.
3. Object Storage Asset Finalization Reaction
- Subscribed Events:
FormSubmissionValidated,FormDraftSessionExpired - Reaction:
- When
FormSubmissionValidatedis emitted, Object Storage flags all associated temporary file upload tokens as permanently retained, locking them against deletion. - When
FormDraftSessionExpiredis emitted, Object Storage purges orphaned, temporary binary files uploaded during the abandoned draft session, reclaiming disk storage.
- When
4. Enterprise Data Lake & BI Reaction
- Subscribed Events:
FormSubmissionValidated,FormSubmissionExported - Reaction:
- Downstream analytical ingest pipelines consume the validated submission stream.
- Maps the dynamic, nested key-value answers into flattened columnar schemas (Parquet/Delta Lake tables) using the schema version’s field definitions as the data dictionary.
- Enables enterprise business intelligence dashboards to query dynamic form submissions using standard SQL queries without experiencing schema drift errors.