Utility library for Genericore modules written for node.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
README.md
package.json

README.md

node-genericore

This package contains an utility library for Genericore modules written for node.

Please note that this is early development software that lacks proper documentation, tests, and a lot of useful or even necessary features.

System requirements

API documentation

genericore.connect(config, callbacks)

Connect to Genericore (using AMQP). Possible config object properties:

  • connection: The options object of node-amqp's amqp.createConnection()

  • reconnect_timeout: If set to a number then trigger a reconnect that number of milliseconds after a connection error occured.

  • input: If set to an AMQP exchange name then subscribe to that exchange (using an auto-generated, exclusive queue).

  • output: If set to an AMQP exchange name then publish to that exchange (using type = fanout).

Possible callbacks object properties (if any of the properties is undefined when the event occurs, then the default (no op if not specified else) gets called. I. e. callbacks may be modified at any time):

  • ready: Called when the output exchange was opened successfully with an object parameter with following properties:

    • publish: A function taking a single string parameter to publish to the output exchange. Undefined if no input exchange was named.
    • end: A function taking no parameters to shutdown the connection to Genericore.
  • message: Called when a message gets published at the input exchange with the message as a string parameter.

  • end: Called when the connection to Genericore is closed.

  • error: (default: reconnect or, if reconnect_timeout is not set, throw error) Called when a connection error occurs.

  • debug: Called when a debug message occurs. Defaults to console.log.