areller
areller

Reputation: 5238

Google PubSub - getting last message

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

Upvotes: 0

Views: 1479

Answers (1)

Emilio Schapira
Emilio Schapira

Reputation: 324

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.

Upvotes: 1

Related Questions