Skip to content

Latest commit

 

History

History
89 lines (66 loc) · 3.21 KB

api-docs.md

File metadata and controls

89 lines (66 loc) · 3.21 KB

Classes

AmqpSugarLib

Sugar methods to work with amqplib.

Typedefs

rabbitConnectionDef : string

RabbitMQ Server definition.

retryBehavior : object

Retry behavior in case RabbitMQ is not available.

AmqpSugarLib

Sugar methods to work with amqplib.

Kind: global class

AmqpSugarLib.publishMessage(opts) ⇒ Promise

Post a message to RabbitMq.

Kind: static method of AmqpSugarLib

Param Type Description
opts object Configuration to use to publish a message.
opts.server object RabbitMQ server. If a string is passed, it's just the URI.
opts.exchange object Information about the exchange.
opts.exchange.type string 'topic', 'direct'
opts.exchange.name string Name of the exchange.
opts.key string Key to publish the message.
opts.message object The message to post.
opts.options Object Options to publish.
opts.correlationId string RabbitMQ's correlationId.
opts.retry_behavior retryBehavior Retry behavior.

AmqpSugarLib.connect() ⇒ 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

Kind: static method of AmqpSugarLib
Returns: Promise - - Returns the promise as defined for amqplib.connect

Param Type Description
opts.server rabbitConnectionDef Connection information for the server.
opts.retry_behavior retryBehavior Retry behavior for establishing the connection.

rabbitConnectionDef : string

RabbitMQ Server definition.

Kind: global typedef

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 retryBehavior empty.
interval number Interval in ms.
times number Amount of times the given operation should be retried.
attempts number Readonly, current amount of attempts.