Skip to content

Latest commit

 

History

History
178 lines (132 loc) · 4.73 KB

api-docs.md

File metadata and controls

178 lines (132 loc) · 4.73 KB

Classes

Lepus
Topology

Members

ValidatorTopology

Validator for topology files.

Functions

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.

Typedefs

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.

Lepus

Kind: global class

Topology

Kind: global class

new Topology()

Topologies.

ValidatorTopology

Validator for topology files.

Kind: global variable

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.

Kind: global function
Returns: Promise - - Returns the promise as defined for amqplib.connect.

value(file)

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)

isJson(str) ⇒ boolean

Helper method to validate if the given string contains valid JSON.

Kind: global function

Param Type Description
str string The string to validate.

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.

Kind: global function

value(connectionDef)

ConnectionDef can be either a string or based on the schema.

Kind: global function

Param
connectionDef

rabbitConnectionDef : string

RabbitMQ Server definition.

Note: passing the Connection definition as an object is not supported, yet.

Kind: global typedef

lepusOptions : object

Options

Kind: global typedef
Properties

Name Type Description
retry_behavior RetryBehavior Behavior how to retry connecting to the server in case of failure.

RetryBehavior : object

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.