LMS Event Producer Behavior
Summary
Source-backed producer triggers, lifecycle checks, state mutation, and save behavior.
Audience
Engineering, integration, QA, architecture, security, and product reviewers.
Reference Content
| Operation | Preconditions / duplicate behavior | State mutation | Contract construction and save boundary |
|---|---|---|---|
| Enrollment assignment | Course must be Published; there is no duplicate pre-check, while a persistence uniqueness constraint protects the tenant/employee/course combination. | Creates an Assigned enrollment. | Calls the lifecycle helper for TrainingAssigned; business state, evidence, and outbox staging reach one SaveChanges call. |
| Enrollment start | Enrollment must be Assigned; repeated or invalid transition conflicts. | Changes enrollment to InProgress and records start time. | Calls the lifecycle helper for TrainingStarted before the same SaveChanges call. |
| Enrollment completion | Enrollment must be Assigned or InProgress; a terminal repeat conflicts. No assessment prerequisite is checked here. | Changes enrollment to Completed and creates one completion record. | Calls the lifecycle helper for TrainingCompleted before the same SaveChanges call. |
| Assessment submission | Attempt must not already be Passed or Failed; outcome is selected by the implemented threshold comparison. | Stores a terminal Passed or Failed attempt result. | Calls the assessment helper, which constructs exactly one outcome contract, before the same SaveChanges call. |
| Certificate issue | Certificate must exist and must not already be Issued. | Changes certificate state to Issued. | Calls the certificate helper for CertificateIssued before the same SaveChanges call. |
| Session create | Course must exist. | Creates a Scheduled session. | Calls the session helper for TrainingSessionScheduled before the same SaveChanges call. |
| Session reschedule | Session and course must exist; repeated valid rescheduling remains permitted. | Updates schedule and marks the session Rescheduled. | Calls the session helper for TrainingSessionRescheduled before the same SaveChanges call. |
All eight are direct helper constructions followed by SaveChanges. This is a local persistence boundary; no distributed transaction with a broker or HTTP dependency is shown. Certificate expiry is not invoked. Course create/publish/archive, content/material changes, learning paths, assessment/attempt creation, certificate document operations, and import lifecycle changes do not emit Training contracts.
Source References
microservices/src/training-service/Api/TrainingEndpoints.csmicroservices/src/training-service/Infrastructure/TrainingDbContext.cs
Related Articles
See Also
Keywords
- LMS events
- Training contracts
- Source-backed integration
Revision Information
- Status: Draft
- Last reviewed: 2026-07-17
- Review cycle: Quarterly