英文:
Google Cloud Engine: PubSub instead of RabbitMQ
问题
我的项目在Google Cloud中使用微服务架构。我正在考虑从使用RabbitMQ的容器迁移到PubSub引擎。
问题是:是否可以逐个接收消息?我的代码是用Go语言编写的,文档中说:
回调函数会被多个goroutine并发调用,以最大化吞吐量。
但是可以调用多少个goroutine呢?我如何设置最大允许的数量?例如,我的一个工作进程与第三方API进行通信,每个IP只允许一个连接,所以我每次只能处理一个任务。
英文:
My project has microserver architecture working in Google Cloud. I'm thinking about moving from container with RabbitMQ to PubSub engine.
The question is: is it possible to receive messages one by one? My code is written on Go and docs says
> The callback is invoked concurrently by multiple goroutines,
> maximizing throughput.
But how many goroutines can be invoked? How can I set the max allowed? E.g. one of my workers works with third-party API allowing only one connection per IP, so I can have only one task in time for this worker.
答案1
得分: 1
正确的解决方案是使用App Engine任务拉取队列。
https://cloud.google.com/appengine/docs/standard/go/taskqueue/overview-pull
英文:
Correct solution is App Engine Task Pull Queues
https://cloud.google.com/appengine/docs/standard/go/taskqueue/overview-pull
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论