@alliedpayment/message-bridge
TypeScript icon, indicating that this package has built-in type declarations

3.2.9 • Public • Published

@alliedpayment/message-bridge

Bridge to send RabbitMQ messages to Allied's queues.

Allied uses NServiceBus which requires special headers.

This bridge wraps ampqlib and providing publisher API that handles the needed headers.

Notes:

  • environment variable RABBITMQ_CONNECTION_STRING is expected to be set

example:

"amqp://guest:guest@localhost:5672"

Usage

import bus, { IMessage } from "../src/index";

const queue = "test";

const run = async () => {
  const message: IMessage = {
    $type: "Allied.Data.NServiceBus.Messages.Test.TestMessage",
    payload: {
      id: "123",
      test: "test",
    },
  };
  try {
    const result = await bus.send(queue, message);
    log.info(`send result: ${result ? "successful" : "failed"}`);
    process.exit(0);
  } catch (error) {
    log.error(error);
    process.exit(1);
  }
};

run();

Package Sidebar

Install

npm i @alliedpayment/message-bridge

Weekly Downloads

6

Version

3.2.9

License

MIT

Unpacked Size

17.2 kB

Total Files

14

Last publish

Collaborators

  • jerry.wickey
  • harikakunda
  • ktodoran
  • weispm01