@opzkit/nodeamqp
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

nodeamqp

Nodeamqp provides an opinionated way of using RabbitMQ for event-driven architectures.

Getting Started

Add the dependency

yarn add @opzkit/nodeamqp

Usage

See the 'examples' subdirectory.

Contributing

TODO

References

License

MIT - see LICENSE for more details.

Developing

TODO

Tests

yarn run test

Example message logger

An example message logger which dumps messages to console.

const StdOutMessageLogger = (
  content: Buffer,
  routingKey: string,
  outgoing: boolean
) => {
  let out: string = content.toString("utf-8");
  try {
    out = JSON.stringify(JSON.parse(out), null, 2);
  } catch (e) {
    // Ignore errors since out is already set
  }
  if (outgoing) {
    console.log(
      `Sending using routingkey: '${routingKey}' with content:\n${out}\n`
    );
  } else {
    console.log(
      `Received from routingkey '${routingKey}' with content:\n${out}\n`
    );
  }
};

Package Sidebar

Install

npm i @opzkit/nodeamqp

Weekly Downloads

449

Version

0.5.0

License

MIT

Unpacked Size

31.1 kB

Total Files

16

Last publish

Collaborators

  • argoyle