google cloud pubsub node.js client not compatible with google cloud functions

前端 未结 3 1044
挽巷
挽巷 2020-12-17 03:58

Architecture:

We have an architecture using 2 pubsub topic/subscription pairs:

  • Topic T1 is triggered by a cronjob periodically (every 5
3条回答
  •  心在旅途
    2020-12-17 04:27

    I ran into the same problem, I wanted better control over .ack(). Looking at the nodejs library from google, it would an option to refactor the ack() to return a promise so the function can wait for ack()to complete.

    Subscriber.prototype.ack_ = function(message) {
      var breakLease = this.breakLease_.bind(this, message);
    
      this.histogram.add(Date.now() - message.received);
    
      if (this.writeToStreams_ && this.isConnected_()) {
        this.acknowledge_(message.ackId, message.connectionId).then(breakLease);
        return;
      }
    
      this.inventory_.ack.push(message.ackId);
      this.setFlushTimeout_().then(breakLease);
    };
    

提交回复
热议问题