
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@devgrid/rotif-nest
Advanced tools
A NestJS integration module for the @devgrid/rotif Redis-based notification system. This module provides seamless integration of rotif's messaging capabilities into NestJS applications with additional features like dependency injection, decorators, health checks, and automatic discovery of message handlers.
@nestjs/terminusnpm install @devgrid/rotif @devgrid/rotif-nest
import { Module } from '@nestjs/common';
import { RotifModule } from '@devgrid/rotif-nest';
@Module({
imports: [
RotifModule.register({
redis: 'redis://localhost:6379',
// Additional rotif configuration options
}),
],
})
export class AppModule {}
import { Injectable } from '@nestjs/common';
import { RotifSubscribe } from '@devgrid/rotif-nest';
@Injectable()
export class OrdersService {
@RotifSubscribe('orders.created', {
group: 'orders-service',
maxRetries: 3
})
async handleOrderCreated(message: RotifMessage) {
const order = message.payload;
await this.processOrder(order);
}
}
import { Injectable } from '@nestjs/common';
import { RotifService } from '@devgrid/rotif-nest';
@Injectable()
export class NotificationService {
constructor(private readonly rotifService: RotifService) {}
async notifyOrderShipped(orderId: string) {
await this.rotifService.publish('orders.shipped', {
orderId,
shippedAt: new Date()
});
}
}
import { Module } from '@nestjs/common';
import { RotifModule } from '@devgrid/rotif-nest';
import { ConfigService } from '@nestjs/config';
@Module({
imports: [
RotifModule.registerAsync({
useFactory: (configService: ConfigService) => ({
redis: configService.get('REDIS_URL'),
exactlyOnce: true,
deduplication: {
type: 'redis',
ttlSeconds: 3600
},
middleware: [
new LoggingMiddleware(),
new MetricsMiddleware()
],
globalExceptionFilters: [
RotifExceptionFilter
],
globalInterceptors: [
RotifLoggingInterceptor,
RotifMetricsInterceptor
]
}),
inject: [ConfigService]
})
]
})
export class AppModule {}
import { Controller, Get } from '@nestjs/common';
import { HealthCheck, HealthCheckService } from '@nestjs/terminus';
import { RotifHealthService } from '@devgrid/rotif-nest';
@Controller('health')
export class HealthController {
constructor(
private health: HealthCheckService,
private rotifHealth: RotifHealthService
) {}
@Get()
@HealthCheck()
check() {
return this.health.check([
() => this.rotifHealth.check()
]);
}
}
import { RotifException } from '@devgrid/rotif-nest';
throw new RotifException('Failed to process order', true); // true = move to DLQ
import { Catch } from '@nestjs/common';
import { RotifMessage } from '@devgrid/rotif';
import { RotifExceptionFilter } from '@devgrid/rotif-nest';
@Catch()
export class CustomRotifExceptionFilter extends RotifExceptionFilter {
async catch(exception: Error, message: RotifMessage) {
// Custom error handling logic
await super.catch(exception, message);
}
}
import { Injectable } from '@nestjs/common';
import { Middleware, RotifMessage } from '@devgrid/rotif';
@Injectable()
export class CustomMiddleware implements Middleware {
async beforeProcess(msg: RotifMessage): Promise<void> {
// Pre-processing logic
}
async afterProcess(msg: RotifMessage): Promise<void> {
// Post-processing logic
}
async onError(msg: RotifMessage, error: Error): Promise<void> {
// Error handling logic
}
}
import { Injectable } from '@nestjs/common';
import { RotifMetricsInterceptor } from '@devgrid/rotif-nest';
@Injectable()
export class CustomMetricsInterceptor extends RotifMetricsInterceptor {
intercept(context: ExecutionContext, next: CallHandler) {
// Custom metrics collection logic
return super.intercept(context, next);
}
}
The main module that provides rotif integration.
register(options: RotifModuleOptions): Registers the module with static optionsregisterAsync(options: RotifModuleAsyncOptions): Registers the module with async optionsThe main service for interacting with rotif.
publish(channel: string, payload: any, options?: PublishOptions): Publishes a messagesubscribe(pattern: string, handler: Function, options?: SubscribeOptions): Subscribes to messagessubscribeToDLQ(handler: Function): Subscribes to the Dead Letter QueuerequeueFromDLQ(count?: number): Requeues messages from DLQService for health checks.
check(): Performs a health check of the rotif connection@RotifSubscribe(pattern: string, options?: SubscribeOptions): Marks a method as a message handlerinterface RotifModuleOptions extends RotifConfig {
middleware?: Middleware[];
globalExceptionFilters?: Type<any>[];
globalInterceptors?: Type<any>[];
exactlyOnce?: boolean;
deduplication?: {
type: 'redis' | 'memory';
ttlSeconds?: number;
};
}
interface RotifModuleAsyncOptions {
useFactory?: (...args: any[]) => Promise<RotifModuleOptions> | RotifModuleOptions;
inject?: any[];
useClass?: Type<RotifModuleOptionsFactory>;
useExisting?: Type<RotifModuleOptionsFactory>;
}
Error Handling
Performance
Testing
Security
Contributions are welcome! Please see our Contributing Guide for details.
MIT © DevGrid
FAQs
Unknown package
We found that @devgrid/rotif-nest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.