How to use haredo - 2 common examples

To help you get started, we’ve selected a few haredo 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 bamlab / nest-rabbit-tasks / src / nest-rabbit-tasks.rabbitClient.ts View on Github external
public static async buildQueueConnection(option: NestRabbitTasksQueueOptions, logger: Logger): Promise {
    console.log(option.amqpOptions);
    const connection = new Haredo({ connection: option.amqpOptions.connectionUrl });

    if (option.globalOptions.immutableInfrastructure) {
      const channel = await connection.connectionManager.getChannel();
      try {
        await channel.checkQueue(option.entity.queueName);
      } catch (err) {
        if (err.code === 404) {
          const msg = `You have activated "globalOptions.immutableInfrastructure".
          This prevents nest-rabbit-tasks to create non-existent queue.
          The queue ${option.entity.queueName} does not exist.
          Please create it in RabbitMQ interface.`;
          logger.error(msg);
          return null;
        }
        throw err;
      }
github bamlab / nest-rabbit-tasks / src / nest-rabbit-tasks.module.ts View on Github external
public onModuleInit() {
    setLoggers({
      error: this.logger.error.bind(this.logger),
      info: this.logger.log.bind(this.logger),
      debug: this.logger.debug.bind(this.logger),
    });
    this.bindMessageFromQueueToMessageHandlerInWorker();
  }

haredo

A type-safe client library for rabbitmq/amqp

MIT
Latest version published 2 years ago

Package Health Score

55 / 100
Full package analysis

Popular haredo functions