Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 48 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* tslint:disable:max-classes-per-file */ |
||
2 | import { Injectable } from '@nestjs/common'; |
||
3 | import { ClientProxy, ReadPacket, Transport, WritePacket } from '@nestjs/microservices'; |
||
4 | import { Publisher } from '../../../../src/decorators/transport.publisher.event-bus.decorator'; |
||
5 | import { defer, Observable, } from 'rxjs'; |
||
6 | import { Storage } from '../storage/storage'; |
||
7 | |||
8 | @Injectable() |
||
9 | export class TestClientProxy extends ClientProxy { |
||
10 | constructor( |
||
11 | private storage: Storage |
||
12 | ) { |
||
13 | super(); |
||
14 | } |
||
15 | |||
16 | send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<any> { |
||
17 | this.storage.upsert('Rabbit', data['payload']['message']);// tslint:disable-line |
||
18 | return defer(() => Promise.resolve()); |
||
19 | } |
||
20 | |||
21 | close(): any { |
||
22 | return undefined; |
||
23 | } |
||
24 | |||
25 | connect(): Promise<any> { |
||
26 | return undefined; |
||
27 | } |
||
28 | |||
29 | protected dispatchEvent<T = any>(packet: ReadPacket<any>): Promise<T> { |
||
30 | return undefined; |
||
31 | } |
||
32 | |||
33 | protected publish(packet: ReadPacket<any>, callback: (packet: WritePacket) => void): any { |
||
34 | return undefined; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | @Injectable() |
||
39 | @Publisher(Transport.RMQ) |
||
40 | export class RabbitPublisher { |
||
41 | constructor( |
||
42 | private client: TestClientProxy |
||
43 | ) { |
||
44 | // TODO |
||
45 | } |
||
46 | |||
47 | } |
||
48 |