Skip to content

opzkit/nodeamqp

Folders and files

NameName
Last commit message
Last commit date
Mar 3, 2025
Feb 28, 2022
Mar 3, 2025
Feb 5, 2022
Feb 5, 2022
Mar 3, 2025
Mar 3, 2025
Jun 6, 2024
Feb 5, 2022
Feb 5, 2022
Feb 5, 2022
Feb 5, 2022
Mar 3, 2025
Jan 14, 2025
Feb 5, 2022
Mar 12, 2025

Repository files navigation

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`
    );
  }
};