- ValidatorTopology
Validator for topology files.
- value() ⇒
Promise
Connect to RabbitMQ.
Very similar to amqp.connect, but with the big difference, that if the connection fails, the operation will retry as defined in opts.retry_behavior.
Furthermore, in case there is already an existing connection available, this will be returned. No new connection will be established.
- value(file)
- isJson(str) ⇒
boolean
Helper method to validate if the given string contains valid JSON.
- value()
Validate the topology file:
- The file has to exist
- The file has to be either a .yml or a .json file
This method does not validate the content of the file.
- value(connectionDef)
ConnectionDef can be either a string or based on the schema.
- rabbitConnectionDef :
string
RabbitMQ Server definition.
Note: passing the Connection definition as an object is not supported, yet.
- lepusOptions :
object
Options
- RetryBehavior :
object
Retry behavior in case RabbitMQ is not available.
Topologies.
Validator for topology files.
Connect to RabbitMQ.
Very similar to amqp.connect, but with the big difference, that if the connection fails, the operation will retry as defined in opts.retry_behavior.
Furthermore, in case there is already an existing connection available, this will be returned. No new connection will be established.
Kind: global function
Returns: Promise
- - Returns the promise as defined for amqplib.connect.
Kind: global function
Todo
- document properly
Load the topology file and return a topology class. Runs all validations first. The file can either be a valid yml or json file.
Param | Type | Description |
---|---|---|
file | String |
The absolute path to the file containing the topology (can be either a .json or a .yml/.yaml file) |
Helper method to validate if the given string contains valid JSON.
Kind: global function
Param | Type | Description |
---|---|---|
str | string |
The string to validate. |
Validate the topology file:
- The file has to exist
- The file has to be either a .yml or a .json file
This method does not validate the content of the file.
ConnectionDef can be either a string or based on the schema.
Kind: global function
Param |
---|
connectionDef |
RabbitMQ Server definition.
Note: passing the Connection definition as an object is not supported, yet.
Options
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
retry_behavior | RetryBehavior |
Behavior how to retry connecting to the server in case of failure. |
Retry behavior in case RabbitMQ is not available.
Kind: global typedef
Read only: true
Properties
Name | Type | Description |
---|---|---|
retries | number |
The maximum amount of times to retry the operation. Defaults to 10. |
enabled | boolean |
Whether retry is enabled at all or not (defaults to true); setting to false is equal to keeping retry_behavior empty. |
interval | number |
Interval in ms. |
times | number |
Amount of times the given operation should be retried. |
attempts | number |
Readonly, current amount of attempts. |