Producer

new Producer(x, y, name, publishes)

Producer class represents a component that publishs against exchanges.
Parameters:
NameTypeDescription
xnumberx position of the producer
ynumbery position of the producer
namestringoptional identifier
publishesobject | Arraylist of exchanges to publish to

Extends

Methods

addMessageToExchange(exchange, message)

Adds a message to an exchange.
Parameters:
NameTypeDescription
exchangeExchangeExchange object
messageObjectJSON message with headers and body

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

exchangeWithRoutingKeyExists(exchange, routingKey)

Checks for exchange in combination with routing key to exists.
Parameters:
NameTypeDescription
exchangeExchangeExchange object
routingKeystringrouting key

removeExchange(exchange)

Removes the exchange from the list.
Parameters:
NameTypeDescription
exchangeExchangeExchange object

render()

Render the producer and draw lines to every exchange from the list.

update(dt)

Determines at which time a new message be published.
Parameters:
NameTypeDescription
dtnumberdelta time from the timer