Skip to content

WorkSessionCreatedEvent

EventType: WORK_SESSION_CREATEDDomain: work_session Broker subject: progress.notification.production

Inserts a new WorkSession document linking an operator to their active batch on a job. Each time an operator starts or resumes a job, a new work session is created. The session records user, job, batch, phase, product, work order, and an optional end timestamp for pre-set session limits.

Trigger

Triggered by: POST /event (universal event dispatcher)

Spawned as a child event by JobStartedEvent (initial session) and by JobResumedEvent (resumed session) in backend/api/events/production/.

Preconditions

  • Job exists with key info.job_key
  • Batch exists with key info.batch_key
  • User exists with key info.user_key

State Changes (Transaction)

Collections: WorkSession

  • WorkSession document inserted with all provided keys and timestamps

Side Effects (post_processing)

Inherits post_processing() from BaseProductionEvent:

  • Updates job.last_online
  • Recalculates work order status
  • Publishes to progress.notification.production

InfoModel Fields

FieldTypeDescription
user_keystrArangoDB key of the operator
user_session_keystr | NoneOptional external user session key
job_keystrArangoDB key of the job
batch_keystrArangoDB key of the active batch
work_order_keystrArangoDB key of the work order
phase_keystrArangoDB key of the production phase
product_keystrArangoDB key of the product
work_session_enddatetime | NonePre-set session end time (for timed sessions)
forcedbool | NoneWhether the session was created by an administrative override

None.

Source

WorkSessionCreatedEvent on GitHub

Released under the Apache 2.0 License.