I am trying to publish multiple message at time (around 50) but Pub/Sub is giving is Deadline Exceeded at /user_code/node_modules/@google-cloud/pubsub/node_modules/grpc/src/client.js:55
error.
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;
});
})
For single message it's working fine. For batching I try the batch configuration of publisher but it is also not working
const publisher = topic.publisher({
batching: {
maxMessages: 15,
maxMilliseconds: 2000
}
});
Once creating subscription please change Acknowledgement Deadline of subscription time for default 10 sec to 100 sec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With