mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 16:59:41 +02:00
✨ feat(mana-notify): add central notification service
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.
This commit is contained in:
parent
1495dbe476
commit
b5fa0f42b6
66 changed files with 4824 additions and 0 deletions
73
services/mana-notify/src/queue/queue.module.ts
Normal file
73
services/mana-notify/src/queue/queue.module.ts
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
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 {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue