Consumer

new Consumer(x, y, name, consumes, mode)

Consumer class represents a component which consumes messages from a queue.
Parameters:
NameTypeDescription
xnumberx position of the consumer
ynumbery position of the consumer
namestringoptional identifier
consumes*
modestringack or reject

Extends

Methods

addQueue(queue)

Adds a queue to the list.
Parameters:
NameTypeDescription
queueQueueQueue object

addToScene(scene) → {object}

Add an object as actor to scene.
Parameters:
NameTypeDescription
sceneScenescene on canvas
Inherited From
Returns:
this
Type: 
object

createUUID() → {string}

Generates an UUID, used to identify every object in the scene.
https://www.w3resource.com/javascript-exercises/fundamental/javascript-fundamental-exercise-253.php
Inherited From
Returns:
- uuid
Type: 
string

messageArrived(msg)

Handler for arriving messages. Checks the mode and reject or count the arrived messages.
Parameters:
NameTypeDescription
msgQueueMessagemessage object

removeQueue(queue)

Removes a queue from the list or empty the list.
Parameters:
NameTypeDescription
queueQueueQueue object