This is a Worker script that is used as "threaded queue" for managing SCION event execution:
New events for SCION are queued in order to allow raising new events from within SCION-event-processing.
This "threaded queue" receives messages from the "WebWorker environment engine" of
mmir.dialogEngine - see mmir.state.StateEngineFactory.StateEngineWebWorkerImpl.
The message / work flow is as follows:
- on receiving
queueJob: add new event-job to the queue - on receiving
finishedJob: - if queue is empty: does nothing
- if queue is not empty: take next job from queue and send it as a
processNextJobmessage to SCION
Methods
-
onmessage(evt)
-
Handler for received messages.
Name Type Description evtObject the message object with
Name Type Description data.command"finishedJob" | "queueJob" | "destroyQueue" the message type / name (e.g. finishedJob) data.engineIdNumber | String Number the engine's ID for which this job should be queued data.jobmodule:workers/scion-queue~Job optional the job object (e.g. in case of command queueJob the job that will be queued) -
innerdistributeJobs(queue)
-
Handler for sending messages.
In case of
finishedJob: take next job for the engine-queue and send it to SCION, i.e. post a message e with
{String} event.data.command = processNextJob
{Object} event.data.job the job object (that was added before to the queue with command / message queueJobName Type Description queuemodule:workers/scion-queue~JobQueue the job queue