Pub / Sub给出截止日期超出错误

时间:2017-12-26 14:02:38

标签: google-cloud-platform google-cloud-pubsub

我正在尝试在时间(大约50)发布多条消息,但是Pub / Sub正在给出Deadline Exceeded at /user_code/node_modules/@google-cloud/pubsub/node_modules/grpc/src/client.js:55错误。

const pubsub = PubSub();        
const topic = pubsub.topic('send_wishes');  
const publisher = topic.publisher();

//data is dictionary object 
    Object.keys(data).forEach(function(key){
                    var userObj = data[key];
                        const dataBuffer = Buffer.from(JSON.stringify(userObj));
                        const publisher = topic.publisher();
                        publisher.publish(dataBuffer)
                        .then((results) => {
                          const messageId = results[0];
                          console.log(`Message ${messageId} published.`);
                          return;
                        });
        })

对于单个消息,它工作正常。对于批处理,我尝试了发布者的批量配置,但它也无法正常工作

const publisher = topic.publisher({
            batching: {
              maxMessages: 15,
              maxMilliseconds: 2000
            }
          });

1 个答案:

答案 0 :(得分:1)

创建订阅后,请将确认截止日期的订阅时间更改为默认10秒至100秒。

相关问题