talos-bus
v2.0.10
Published
Talos Bus interface
Downloads
43
Maintainers
Readme
RabbitMQ client using amqplib
Features
- Well-defined API
- Implemented Bus interface for RabbitMQ
- Automatic re-connection
- Message buffering between link failures
- Subscriptions are preserved between re-connections
- Injectable logger, let you use log4js for example
- Easy and intuitive to use
Install
npm install talos-bus
Example
const client = new RabbitMQ(new ClientConfig(
'amqp://guest:guest@localhost:5672'
));
const isConnected: boolean = await client.connect();
const subscription: Subscription = QueueSubscriptionBuilder.newBuilder("logs").isAutoDelete(true).build();
await client.subscribe(subscription);
subscription.on("message", console.log);
const sent: boolean = client.publish(Message.toQueue('logs', Buffer.from('message')));