mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 01:41:08 +02:00
NestJS notification microservice for email, push, Matrix, and webhook notifications across all ManaCore apps. Features: - Multi-channel delivery (email, push, Matrix, webhook) - Handlebars template engine with defaults - User notification preferences - BullMQ async job processing - Delivery tracking and logging - Prometheus metrics Includes @manacore/notify-client package for NestJS integration.
73 lines
1.6 KiB
TypeScript
73 lines
1.6 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { BullModule } from '@nestjs/bullmq';
|
|
import { EmailProcessor } from './processors/email.processor';
|
|
import { PushProcessor } from './processors/push.processor';
|
|
import { MatrixProcessor } from './processors/matrix.processor';
|
|
import { WebhookProcessor } from './processors/webhook.processor';
|
|
import { ChannelsModule } from '../channels/channels.module';
|
|
import { MetricsModule } from '../metrics/metrics.module';
|
|
|
|
export const EMAIL_QUEUE = 'email';
|
|
export const PUSH_QUEUE = 'push';
|
|
export const MATRIX_QUEUE = 'matrix';
|
|
export const WEBHOOK_QUEUE = 'webhook';
|
|
|
|
@Module({
|
|
imports: [
|
|
BullModule.registerQueue(
|
|
{
|
|
name: EMAIL_QUEUE,
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: 'exponential',
|
|
delay: 5000,
|
|
},
|
|
removeOnComplete: 100,
|
|
removeOnFail: 1000,
|
|
},
|
|
},
|
|
{
|
|
name: PUSH_QUEUE,
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: 'exponential',
|
|
delay: 1000,
|
|
},
|
|
removeOnComplete: 100,
|
|
removeOnFail: 1000,
|
|
},
|
|
},
|
|
{
|
|
name: MATRIX_QUEUE,
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: 'exponential',
|
|
delay: 2000,
|
|
},
|
|
removeOnComplete: 100,
|
|
removeOnFail: 500,
|
|
},
|
|
},
|
|
{
|
|
name: WEBHOOK_QUEUE,
|
|
defaultJobOptions: {
|
|
attempts: 5,
|
|
backoff: {
|
|
type: 'exponential',
|
|
delay: 3000,
|
|
},
|
|
removeOnComplete: 100,
|
|
removeOnFail: 1000,
|
|
},
|
|
}
|
|
),
|
|
ChannelsModule,
|
|
MetricsModule,
|
|
],
|
|
providers: [EmailProcessor, PushProcessor, MatrixProcessor, WebhookProcessor],
|
|
exports: [BullModule],
|
|
})
|
|
export class QueueModule {}
|