mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
54 lines
1006 B
TypeScript
54 lines
1006 B
TypeScript
/**
|
|
* @publicApi
|
|
*/
|
|
export interface RmqRecordOptions {
|
|
expiration?: string | number;
|
|
userId?: string;
|
|
CC?: string | string[];
|
|
mandatory?: boolean;
|
|
persistent?: boolean;
|
|
deliveryMode?: boolean | number;
|
|
BCC?: string | string[];
|
|
contentType?: string;
|
|
contentEncoding?: string;
|
|
headers?: Record<string, string>;
|
|
priority?: number;
|
|
messageId?: string;
|
|
timestamp?: number;
|
|
type?: string;
|
|
appId?: string;
|
|
}
|
|
|
|
/**
|
|
* @publicApi
|
|
*/
|
|
export class RmqRecord<TData = any> {
|
|
constructor(
|
|
public readonly data: TData,
|
|
public options?: RmqRecordOptions,
|
|
) {}
|
|
}
|
|
|
|
/**
|
|
* @publicApi
|
|
*/
|
|
export class RmqRecordBuilder<TData> {
|
|
private options?: RmqRecordOptions;
|
|
|
|
constructor(private data?: TData) {}
|
|
|
|
public setOptions(options: RmqRecordOptions): this {
|
|
this.options = options;
|
|
return this;
|
|
}
|
|
|
|
public setData(data: TData): this {
|
|
this.data = data;
|
|
return this;
|
|
}
|
|
|
|
public build(): RmqRecord {
|
|
return new RmqRecord(this.data, this.options);
|
|
}
|
|
}
|