Google PubSub - getting last message

浪子不回头ぞ 提交于 2020-01-17 06:54:38

问题


I am beginning to work with google app engine and the services it offers. One service that I am particularly interested in is the cloud pubsub.

My plan is to have a nodejs socket.io server which subscribes to some pubsub topic and whenever the topic receives a publish it would send that publish to all sockets.

At the other end, I would have a .NET/Java service that publishes messages to various topics.

My question is this - Is there a way to get the last message that was published to a topic?

There could be a case where the nodejs server was down and the publishing service didn't publish anything for a while.

If I were using Redis, I could do publish and set, what is the equivalent of publish and set in pubsub? Would memcache be a good solution?

Thank you


回答1:


Google Cloud Pub/Sub does no offer a way to transactionally publish and write to a database. You would need to publish to Pub/Sub, and have a subscriber that writes the "last value" to the database. Depending on how reliable and durable you need this, memcache could be a good option, or DataStore for better reliability. This will provide eventual consistency.



来源:https://stackoverflow.com/questions/37773234/google-pubsub-getting-last-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!