谷歌云引擎:使用PubSub替代RabbitMQ

huangapple go评论139阅读模式
英文:

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

huangapple
  • 本文由 发表于 2017年8月31日 17:46:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/45978340.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定