@alliedpayment/message-bridge
v3.2.9
Published
apn message bridge ( sets nservice bus headers so node apps can send messages to allied workers )
Downloads
49
Readme
@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();