Skip to content

Commit

Permalink
Merge pull request #4180 from novuhq/inbound-mail-queue-metrics
Browse files Browse the repository at this point in the history
Add inbound mail Queue to metrics
  • Loading branch information
Cliftonz authored Nov 28, 2023
2 parents 63f7fe8 + d1edbf9 commit 8123a64
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getInboundParseMailWorkerOptions,
InboundParseQueue,
InboundParseQueueService as InboundParseQueue,
InboundParseWorker,
Queue,
QueueOptions,
Expand Down
2 changes: 1 addition & 1 deletion apps/inbound-mail/src/server/inbound-mail.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Inbound Mail Service', () => {

it('should be initialised properly', async () => {
expect(inboundMailService).to.be.ok;
expect(inboundMailService).to.have.all.keys('inboundParseQueue');
expect(inboundMailService).to.have.all.keys('inboundParseQueueService');
expect(inboundMailService.inboundParseQueueService.DEFAULT_ATTEMPTS).to.equal(3);
expect(inboundMailService.inboundParseQueueService.topic).to.equal('inbound-parse-mail');
expect(await inboundMailService.inboundParseQueueService.bullMqService.getStatus()).to.deep.equal({
Expand Down
10 changes: 3 additions & 7 deletions apps/inbound-mail/src/server/inbound-mail.service.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { BullMqService, InboundParseQueue, QueueBaseOptions } from '@novu/application-generic';
import { BullMqService, InboundParseQueueService, QueueBaseOptions } from '@novu/application-generic';
import { JobTopicNameEnum } from '@novu/shared';

export class InboundMailService {
private inboundParseQueue: InboundParseQueue;
public inboundParseQueueService: InboundParseQueueService;

constructor() {
this.inboundParseQueue = new InboundParseQueue();
}

public get inboundParseQueueService() {
return this.inboundParseQueue;
this.inboundParseQueueService = new InboundParseQueueService();
}
}
8 changes: 6 additions & 2 deletions packages/application-generic/src/custom-providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import {
CacheInMemoryProviderService,
CacheService,
DistributedLockService,
ExecutionLogQueueService,
FeatureFlagsService,
InboundParseQueueService,
ReadinessService,
StandardQueueService,
SubscriberProcessQueueService,
WebSocketsQueueService,
WorkflowQueueService,
ExecutionLogQueueService,
} from '../services';
import {
GetIsApiRateLimitingEnabled,
Expand Down Expand Up @@ -129,14 +130,16 @@ export const bullMqTokenList = {
webSocketsQueueService: WebSocketsQueueService,
workflowQueueService: WorkflowQueueService,
subscriberProcessQueueService: SubscriberProcessQueueService,
executionLogQueueService: ExecutionLogQueueService
executionLogQueueService: ExecutionLogQueueService,
inboundParseQueueService: InboundParseQueueService
) => {
return [
standardQueueService,
webSocketsQueueService,
workflowQueueService,
subscriberProcessQueueService,
executionLogQueueService,
inboundParseQueueService,
];
},
inject: [
Expand All @@ -145,5 +148,6 @@ export const bullMqTokenList = {
WorkflowQueueService,
SubscriberProcessQueueService,
ExecutionLogQueueService,
InboundParseQueueService,
],
};
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Injectable } from '@nestjs/common';

import { InboundParseQueue } from '../services/queues';
import { InboundParseQueueService } from '../services/queues';
import { QueueHealthIndicator } from './queue-health-indicator.service';

const LOG_CONTEXT = 'InboundParseQueueServiceHealthIndicator';
const INDICATOR_KEY = 'inboundParseQueue';
const INDICATOR_KEY = 'inboundParseQueueService';
const SERVICE_NAME = 'InboundParseQueueService';

@Injectable()
export class InboundParseQueueServiceHealthIndicator extends QueueHealthIndicator {
constructor(private inboundParseQueueService: InboundParseQueue) {
constructor(private inboundParseQueueService: InboundParseQueueService) {
super(inboundParseQueueService, INDICATOR_KEY, SERVICE_NAME, LOG_CONTEXT);
}
}
6 changes: 3 additions & 3 deletions packages/application-generic/src/modules/queues.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
ActiveJobsMetricQueueService,
CompletedJobsMetricQueueService,
ExecutionLogQueueService,
InboundParseQueue,
InboundParseQueueService,
StandardQueueService,
SubscriberProcessQueueService,
WebSocketsQueueService,
Expand All @@ -39,7 +39,7 @@ const PROVIDERS: Provider[] = [
CompletedJobsMetricQueueService,
CompletedJobsMetricQueueServiceHealthIndicator,
CompletedJobsMetricWorkerService,
InboundParseQueue,
InboundParseQueueService,
InboundParseWorker,
InboundParseQueueServiceHealthIndicator,
ReadinessService,
Expand All @@ -65,7 +65,7 @@ const PROVIDERS: Provider[] = [
export class QueuesModule {}

const APP_PROVIDERS: Provider[] = [
InboundParseQueue,
InboundParseQueueService,
InboundParseWorker,
InboundParseQueueServiceHealthIndicator,
WebSocketsQueueService,
Expand Down
2 changes: 1 addition & 1 deletion packages/application-generic/src/services/queues/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export {
QueueBaseService,
ActiveJobsMetricQueueService,
CompletedJobsMetricQueueService,
InboundParseQueueService as InboundParseQueue,
InboundParseQueueService,
StandardQueueService,
WebSocketsQueueService,
WorkflowQueueService,
Expand Down

0 comments on commit 8123a64

Please sign in to comment.