Tabnine Logo For Javascript
rhea-promise
Code IndexAdd Tabnine to your IDE (free)

How to use rhea-promise

Best JavaScript code snippets using rhea-promise(Showing top 15 results out of 315)

origin: moleculerjs/moleculer

jest.fn(() => new rhea.Connection())
origin: moleculerjs/moleculer

/**
   * Disconnect from an AMQP 1.0 server
   * Close every receiver on the connections and the close the connection
   * @memberof Amqp10Transporter
   */
  disconnect() {
    if (this.connection) {
      return this.broker.Promise.all(this.receivers.map(receiver => receiver.close()))
        .then(() => this.connection.close())
        .then(() => {
          this.connection = null;
          this.connected = false;
          this.session = null;
          this.receivers = [];
        })
        .catch(error => this.logger.error(error));
    }
  }
origin: moleculerjs/moleculer

/**
   * Subscribe to balanced event command
   * For EVENTB command types
   * These queues will be used when the "disableBalancer" set to true
   *
   * @param {String} event
   * @param {String} group
   * @memberof Amqp10Transporter
   */
  subscribeBalancedEvent(event, group) {
    const queue = `${this.prefix}.${PACKET_EVENT}B.${group}.${event}`;
    const receiverOptions = Object.assign(
      {
        source: { address: queue },
        autoaccept: false,
        session: this.session
      },
      this._getQueueOptions(PACKET_EVENT + "LB", true)
    );

    return this.connection.createReceiver(receiverOptions).then(receiver => {
      receiver.on("message", this._consumeCB(PACKET_EVENT, true));

      this.receivers.push(receiver);
    });
  }
origin: moleculerjs/moleculer

};
return this.connection
  .createAwaitableSender(awaitableSenderOptions)
  .then(sender => {
    return sender
      .send(message)
      .catch(this.logger.error)
      .then(() => sender);
  })
  .then(sender => {
    return sender.close({ closeSession: false });
  })
  .catch(error => this.logger.error(error));
origin: moleculerjs/moleculer

jest.fn(() => Promise.resolve(new rhea.Session()))
origin: moleculerjs/moleculer

  this._getQueueOptions(PACKET_REQUEST, true)
);
return this.connection.createReceiver(receiverOptions).then(receiver => {
  if (this.opts.prefetch !== 0) {
    receiver.addCredit(this.opts.prefetch);
  receiver.on("message", context => {
    const cb = this._consumeCB(PACKET_REQUEST, true)(context);
    if (isPromise(cb) && this.opts.prefetch !== 0) {
      return cb.then(() => receiver.addCredit(1));
      receiver.addCredit(1);
origin: moleculerjs/moleculer

};
return this.connection
  .createAwaitableSender(awaitableSenderOptions)
  .then(sender => {
    return sender
      .send(message)
      .catch(this.logger.error)
      .then(() => sender);
  })
  .then(sender => {
    return sender.close({ closeSession: false });
  })
  .catch(error => this.logger.error(error));
origin: moleculerjs/moleculer

  rhea.Connection.prototype.open = jest.fn(() => Promise.reject());
      expect(transporter.connection).toBeNull();
      expect(transporter.connected).toEqual(false);
      rhea.Connection.prototype.open = jest.fn(() => Promise.resolve(new rhea.Connection()));
    });
});
  transporter.receivers = [new rhea.Receiver(), new rhea.Receiver()];
  return transporter
    .connect()
origin: moleculerjs/moleculer

const connection = container.createConnection(connectionOptions);
connection.on("disconnected", e => {
  this.logger.info("AMQP10 disconnected.");
  this.connected = false;
  if (e) {
    this.logger.error("AMQP10 connection error.", (this.connection && this.connection.error) || "");
    errorCallback && errorCallback(e);
  .open()
  .then(connection => {
    this.connection = connection;
    this.connection.createSession().then(session => {
      this.session = session;
      this.logger.info("AMQP10 is connected");
      this.connection._connection.setMaxListeners(0);
      this.session._session.setMaxListeners(0);
      this.session.setMaxListeners(0);
      this.connected = true;
      return this.onConnected();
  })
  .catch(e => {
    this.logger.error("AMQP10 connection error.", (this.connection && this.connection.error) || "");
    this.logger.info("AMQP10 is disconnected.");
    this.connected = false;
origin: moleculerjs/moleculer

};
return this.connection
  .createAwaitableSender(awaitableSenderOptions)
  .then(sender => {
    return sender
      .send(message)
      .catch(this.logger.error)
      .then(() => sender);
  })
  .then(sender => {
    return sender.close({ closeSession: false });
  })
  .catch(error => this.logger.error(error));
origin: moleculerjs/moleculer

});
return this.connection.createReceiver(receiverOptions).then(receiver => {
  if (this.opts.prefetch !== 0) {
    receiver.addCredit(this.opts.prefetch);
  receiver.on("message", context => {
    const cb = this._consumeCB(cmd, needAck)(context);
    if (isPromise(cb) && this.opts.prefetch !== 0) {
      return cb.then(() => receiver.addCredit(1));
      receiver.addCredit(1);
  session: this.session
});
return this.connection.createReceiver(receiverOptions).then(receiver => {
  receiver.on("message", context => {
    this._consumeCB(cmd, false)(context);
  });
origin: moleculerjs/moleculer

jest.fn(() => Promise.resolve(new rhea.AwaitableSender()))
origin: moleculerjs/moleculer

jest.fn(() => Promise.resolve(new rhea.Connection()))
origin: moleculerjs/moleculer

jest.fn(() => Promise.resolve(new rhea.Receiver()))
origin: ErickWendel/poc-activemq-nodejs

async connect() {

    try {
      const data = this.connectionData;
      const connection = new Connection({
        ...data,
        reconnect: false,
      });

      this.connection = await connection.open();
    } catch (error) {
      this.tentatives += 1
      if (this.tentatives > 3) {
        console.log('maximum tentatives excedeed', this.tentatives)
        throw error
      }
      console.log('trying to connect again, waiting a second')
      await QueueHandler.sleep(1000)
      return this.connect()
    }

  }
rhea-promise(npm)

Most used rhea-promise functions

  • Connection.createAwaitableSender
  • Connection.createReceiver
  • Connection.open
  • AwaitableSender
  • AwaitableSender.close
  • Connection,
  • Connection._connection,
  • Connection.close,
  • Connection.createSession,
  • Connection.error,
  • Connection.on,
  • Connection.prototype,
  • Container.createConnection,
  • Receiver,
  • Receiver.addCredit,
  • Receiver.on,
  • Session,
  • Session._session,
  • Session.setMaxListeners

Popular in JavaScript

  • commander
    the complete solution for node.js command-line programs
  • js-yaml
    YAML 1.2 parser and serializer
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • axios
    Promise based HTTP client for the browser and node.js
  • fs
  • moment
    Parse, validate, manipulate, and display dates
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • semver
    The semantic version parser used by npm.
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now