Lambda Store

Redis PubSub on Lambda Store

mattiabi profile image Mattia Bianchi ・2 min read

Earlier this week, we announced that Redis Lua scripting is available on Lambda Store, as our attempt to match missing Redis features on Lambda Store.

The next most requested Redis feature was Redis PubSub. We are now enabling Redis PubSub commands with the latest update.

PubSub implements Publish/Subscribe pattern where messages are sent to specific channels or channel patterns and are delivered to subscribers of those channels. This pattern decouples publishers and subscribers and allows publishers to sent messages without any knowledge about subscribers. Messages are broadcasted to all subscribers, not only to the first receiver.

Main use-case of PubSub is event notification; subscribers listen for events on some channels, publishers generate events due to some actions. Using PubSub system, you can implement;

  • A simple chat application, where chat rooms are the PubSub channels and each user in the chat room subscribes and publishes to the channel of the room.

  • A notification system for a multi-tenant application; to broadcast specific events or announcements. For instance a game server and its clients or a backend server and its frontend clients.

Most important limitation of the Redis PubSub mechanism is, it's a synchronous messaging system and it requires all subscribers to be active/online to be able to receive messages. There's no way of receiving earlier messages before the subscription time, there's no durability option while sending the messages.

There's another Redis feature, which is not available on Lambda Store yet, that solves these problems: Redis Streams.

Stay tuned 😉!


Editor guide