evolutty is an asynchronous message dispatcher for concurrent tasks processing, with the following features:
:information_source: Currently, BullMQ, RabbitMQ and AWS SQS are supported
npm i @coaktion/evolutty
import {
BullMQHandler,
BullMQRouter,
EvoluttyManager,
RabbitMQHandler,
RabbitMQRouter,
SQSHandler,
SQSRouter
} from '@coaktion/evolutty';
export class MyBullHandler extends BullMQHandler {
async handle(content: object, metadata: object): Promise<boolean> {
// code here
return true;
}
}
export class MySQSHandler extends SQSHandler {
async handle(content: object, metadata: object): Promise<boolean> {
// code here
return true;
}
}
export class MyRabbitMQHandler extends RabbitMQHandler {
async handle(content: object, metadata: object): Promise<boolean> {
// code here
return true;
}
}
const routers = [
{
routeType: BullMQRouter,
handler: MyBullHandler,
queueName: 'my_queue_bull'
},
{
routeType: SQSRouter,
handler: MySQSHandler,
routeParams: {
accessKeyId: 'test',
secretAccessKey: 'test',
region: 'us-east-1',
visibilityTimeout: 10
},
queueName: 'my_queue_sqs'
},
{
routeType: RabbitMQRouter,
handler: MyRabbitMQHandler,
queueName: 'my_queue_rabbitmq',
routeParams: {
username: 'rabbit_user',
password: '*******',
debug: true
}
}
];
const manager = new EvoluttyManager(routers);
manager.start();
The queueName option is used as a prefix to fetch queues when the prefixBasedQueues option is equals to true on SQS route params (default is false)
You can also customize the logger by setting the environment variables in local.env
file:
LOG_LEVEL=debug # default is info
LOG_FILE_PATH=my_app.log # file that will store the logs if LOG_TRANSPORTS contains file
LOG_TRANSPORTS=console,file # comma separated values (currently only console and file are supported)
LOG_FORMAT=json # json or simple
Evolutty is MIT
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.