开发人员感谢您提出这个问题,我希望您能帮助我摆脱这种情况。
我是谷歌云服务的新手,我正在学习云任务,我必须以编程方式创建队列并添加一些参数,如处理速率、存储桶大小。到目前为止,我无法找到任何解决方案。
我正在通过以下方式创建队列
const createQueue = async (
queueName: string
) => {
const project = 'projectname'; // Your GCP Project id
const queue = queueName; // Name of the Queue to create
const location = 'location name' // The GCP region in which to create the queue
const {
v2beta3
} = require('@google-cloud/tasks');
const client = new v2beta3.CloudTasksClient();
try {
const [response] = await client.createQueue({
parent: client.locationPath(project, location),
queue: {
name: client.queuePath(project, location, queue),
appEngineHttpQueue: {
appEngineRoutingOverride: {
service: 'default'
}
},
},
});
console.log(`Created queue ${response.name}`);
return response.name;
} catch (error) {
console.error(Error(error.message));
}
// return null
}
如何添加处理速率、存储桶大小和最大并发速率等参数