Forms Builder

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 NameSource AggregateEmitted WhenConceptual Payload Highlights
FormBlueprintCreatedFormBlueprintAdministrator registers a new form concept in the platform.BlueprintId, BlueprintCode, Title, Category, OwnerId, CreatedAt.
FormSchemaDraftCreatedFormSchemaVersionA new draft version is instantiated (new form or cloned from prior version).SchemaVersionId, BlueprintId, VersionNumber, ClonedFromVersionId, AuthorId.
FormSchemaPublishedFormSchemaVersionA schema version passes DAG cycle verification and is promoted to active.SchemaVersionId, BlueprintId, VersionNumber, ActiveFieldKeysList, PublishedTimestamp.
FormSchemaDeprecatedFormSchemaVersionA previously active schema version is superceded by a newly published release.SchemaVersionId, BlueprintId, VersionNumber, SupercededByVersionId, Timestamp.
FormSchemaArchivedFormSchemaVersionA schema version is permanently retired and blocked from taking any submissions.SchemaVersionId, BlueprintId, VersionNumber, ArchivedReason, Timestamp.
FormDraftSessionStartedSubmissionDraftSessionA respondent opens an active form and initiates a stateful session.DraftSessionId, SchemaVersionId, SubmitterContext, SessionToken, ExpiresAt.
FormDraftStepSavedSubmissionDraftSessionUser triggers progressive autosave or advances to the next step.DraftSessionId, CurrentStepIndex, AnswerKeysUpdatedList, AutosavedAt.
FormDraftSessionExpiredSubmissionDraftSessionAn unsubmitted draft session surpasses its retention window without completion.DraftSessionId, SchemaVersionId, SubmitterContext, ExpiredAt.
FormSubmissionReceivedFormSubmissionUser commits final submission; payload enters the authoritative validation queue.SubmissionId, BlueprintId, SchemaVersionId, SubmitterContext, ReceivedAt.
FormSubmissionValidatedFormSubmissionServer-side validation passes; answer map is sealed with an SHA-256 hash.SubmissionId, BlueprintId, SchemaVersionId, ValidatedAnswerMap, ResponseHash, Timestamp.
FormSubmissionRejectedFormSubmissionServer validation fails due to type mismatch, regex breach, or unfulfilled mandatory field.SubmissionDraftId, SchemaVersionId, ViolatingFieldErrorsList, RejectedAt.
FormSubmissionProcessedFormSubmissionDownstream consumers (ERP/Workflow) acknowledge processing the submission.SubmissionId, ConsumerDomain, TargetEntityReferenceId, ProcessedAt.
FormQuotaExhaustedFormBlueprintTotal completed submissions reaches the blueprint’s MaxSubmissionsAllowed.BlueprintId, TotalSubmissionsRecorded, ExhaustedAt.
FormExpiredTriggeredFormBlueprintCurrent time surpasses the blueprint’s scheduled ExpirationTimestamp.BlueprintId, ExpirationTimestamp, ClosedAt.
FormSubmissionExportedFormSubmissionTabular 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:
    1. The workflow engine evaluates business routing rules mapped to the BlueprintCode.
    2. Spawns a new workflow instance (e.g., launching an Employee Expense Approval Process or Vendor Onboarding Case).
    3. Binds the SubmissionId and ResponseHash as immutable process variables.
  • 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:
    1. An enterprise adapter translates the ValidatedAnswerMap into internal domain commands.
    2. Example: A customer intake form response triggers RegisterNewCustomerAccount within CRM.
    3. Example: A physical asset damage form triggers CreateMaintenanceWorkOrder in Field Services.
    4. Returns a confirmation event publishing FormSubmissionProcessed back to the Forms Builder for lineage audit tracking.
  • 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 FormSubmissionValidated is emitted, Object Storage flags all associated temporary file upload tokens as permanently retained, locking them against deletion.
    • When FormDraftSessionExpired is emitted, Object Storage purges orphaned, temporary binary files uploaded during the abandoned draft session, reclaiming disk storage.

4. Enterprise Data Lake & BI Reaction

  • Subscribed Events: FormSubmissionValidated, FormSubmissionExported
  • Reaction:
    1. Downstream analytical ingest pipelines consume the validated submission stream.
    2. 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.
    3. Enables enterprise business intelligence dashboards to query dynamic form submissions using standard SQL queries without experiencing schema drift errors.

Our Premium Sponsors

Obelaw is proudly open-source. Continued development, bug fixes, and community support are made possible by the generosity of our sponsors.

Sponsor Obelaw