new Consumer(x, y, name, consumes, mode)
Consumer class represents a component which consumes messages from a queue.
Parameters:
Properties| Name | Type | Description |
|---|---|---|
x | number | x position of the consumer |
y | number | y position of the consumer |
name | string | optional identifier |
consumes | * | |
mode | string | ack or reject |
| Name | Type | Description |
|---|---|---|
arrivedMessages | number | Number of arrived messages |
width | number | Width of the square |
height | number | Height of the square |
queues | object | List of queues to the consumer |
- Source
Extends
Methods
addQueue(queue)
Adds a queue to the list.
Parameters:
| Name | Type | Description |
|---|---|---|
queue | Queue | Queue object |
- Source
addToScene(scene) → {object}
Add an object as actor to scene.
Parameters:
| Name | Type | Description |
|---|---|---|
scene | Scene | scene 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
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 and remove it from the scene.
Parameters:
| Name | Type | Description |
|---|---|---|
msg | QueueMessage | message object |
- Source
removeQueue(queue)
Removes a queue from the list or empty the list.
Parameters:
| Name | Type | Description |
|---|---|---|
queue | Queue | Queue object |
- Source
render()
Render the consumer and draw lines to every queue from the list.
- Source