sample-app.service.ts 566 B

12345678910111213141516171819202122
  1. import { Inject, Injectable } from '@nestjs/common';
  2. import { ClientProxy } from '@nestjs/microservices';
  3. @Injectable()
  4. export class SampleAppService {
  5. constructor(@Inject(`FINGERPRINT_SERVICE`) private client: ClientProxy) {
  6. // logic here
  7. }
  8. getHello(): string {
  9. return 'Hello World! I am Sample App Nestjs.';
  10. }
  11. // testing. Try to talk to Fingerprint App via microservice
  12. talkToFingerprint(message: string): any {
  13. this.client.emit<string>(`eventTest`, message)
  14. return this.client.send<string>({ cmd: `messageTest` }, message)
  15. }
  16. }