I am currently using the Q-promise library in a Node / amqp application. I read that the performance of Q libraries like BlueBird or Vow is not so good.
Unfortunately, I cannot figure out how to use BlueBird (or Vow) to replace my current Q usage patterns.
Here is an example:
this.Start = Q(ampq.connect(url, { heartbeat: heartbeat })) .then((connection) => { this.Connection = connection; return Q(connection.createConfirmChannel()); }) .then((channel) => { this.ConfirmChannel = channel; channel.on('error', this.handleChannelError); return true; });
I should have mentioned - I use TypeScript ... In this example, I take amqplib promises and create a Q sentence from it (because I don't like amqplib promises). How do I do this with BlueBird or Vow?
Another example:
public myMethod(): Q.Promise<boolean> { var ackDeferred = Q.defer<boolean>(); var handleChannelConfirm = (err, ok): void => { if (err !== null) {
How is this template implemented?
So my general questions are:
- Are differences in performance from truth?
- How do I switch from Q to BlueBird or Vow, focusing on these two patterns (but an explanation of using βthenβ would be great too?)
source share