How to use the @nestjs/microservices.ClientProxyFactory.create function in @nestjs/microservices

To help you get started, weโ€™ve selected a few @nestjs/microservices examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nestjs / nest / integration / microservices / src / disconnected.controller.ts View on Github external
call(@Body() options): Observable {
    const client = ClientProxyFactory.create(options);
    return client
      .send({ cmd: 'none' }, [1, 2, 3])
      .pipe(
        /*tap(
        console.log.bind(console, 'data'),
        console.error.bind(console, 'error'),
      ),*/
        catchError(error => {
          const { code } = error || { code: 'CONN_ERR' };
          return throwError(
            code === 'ECONNREFUSED' || code === 'CONN_ERR'
              ? new RequestTimeoutException('ECONNREFUSED')
              : new InternalServerErrorException(),
          );
        }),
      );
github ConnextProject / indra / modules / node / src / messaging / messaging.provider.ts View on Github external
useFactory: (config: ConfigService): ClientProxy => {
    const messagingUrl = config.getMessagingConfig().messagingUrl;
    return ClientProxyFactory.create({
      options: {
        servers: typeof messagingUrl === "string" ? [messagingUrl] : messagingUrl,
      },
      transport: Transport.NATS,
    });
  },
};
github nestjs / nest / integration / microservices / src / rmq / rmq.controller.ts View on Github external
constructor() {
    this.client = ClientProxyFactory.create({
      transport: Transport.RMQ,
      options: {
        urls: [`amqp://localhost:5672`],
        queue: 'test',
        queueOptions: { durable: false },
        socketOptions: { noDelay: true },
      },
    });
  }
github nestjs / nest / integration / microservices / src / rmq / rmq-broadcast.controller.ts View on Github external
constructor() {
    this.client = ClientProxyFactory.create({
      transport: Transport.RMQ,
      options: {
        urls: [`amqp://localhost:5672`],
        queue: 'test_broadcast',
        queueOptions: { durable: false },
        socketOptions: { noDelay: true },
      },
    });
  }