feat(pipeline-task): logger.
This commit is contained in:
@ -5,10 +5,14 @@ import { ApplicationException } from '../commons/exceptions/application.exceptio
|
||||
import { PipelineUnits } from './enums/pipeline-units.enum';
|
||||
import { TaskStatuses } from './enums/task-statuses.enum';
|
||||
import { InjectPinoLogger, PinoLogger } from 'nestjs-pino';
|
||||
import { RabbitSubscribe } from '@golevelup/nestjs-rabbitmq';
|
||||
import { AmqpConnection, RabbitSubscribe } from '@golevelup/nestjs-rabbitmq';
|
||||
import { PipelineTaskEvent } from './models/pipeline-task-event';
|
||||
import { last } from 'ramda';
|
||||
import { Inject } from '@nestjs/common';
|
||||
import {
|
||||
EXCHANGE_PIPELINE_TASK_FANOUT,
|
||||
ROUTE_PIPELINE_TASK_LOG,
|
||||
} from './pipeline-tasks.constants';
|
||||
|
||||
type Spawn = typeof spawn;
|
||||
|
||||
@ -21,6 +25,7 @@ export class PipelineTaskRunner {
|
||||
private readonly logger: PinoLogger,
|
||||
@Inject('spawn')
|
||||
private readonly spawn: Spawn,
|
||||
private readonly amqpConnection: AmqpConnection,
|
||||
) {}
|
||||
@RabbitSubscribe({
|
||||
exchange: 'new-pipeline-task',
|
||||
@ -201,6 +206,15 @@ export class PipelineTaskRunner {
|
||||
messageType,
|
||||
status,
|
||||
};
|
||||
this.amqpConnection
|
||||
.publish(EXCHANGE_PIPELINE_TASK_FANOUT, ROUTE_PIPELINE_TASK_LOG, event)
|
||||
.catch((error) => {
|
||||
this.logger.error(
|
||||
{ error, event },
|
||||
'send event message to queue failed. %s',
|
||||
error.message,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async runScript(
|
||||
|
Reference in New Issue
Block a user