What are the best options for handling subscriptions via the REST API? The obvious answer would be polling but I’d be concerned about the polling frequency required by my projectors to keep my read models up to date in a timely fashion.
I see some nice subscription models for the .NET API but that is not an option for us now. I don’t see any mention about those for the REST API and I’m not sure that it would even make sense for a REST API so I’m not super surprised about this.
Ideally what I’d hope to find is a solution to send out a notification after new events are published. I don’t suspect that this is a hidden feature in Event Store but that would be a pretty nice hidden gem. The best alternative I have come up with would be to write a .NET API application that subscribes to specific streams and sends out notifications itself as soon as it receives them.
The way I’d see my projectors working would be to subscribe to the event publishing notifications and block on that for a polling interval. If no notification was received within the polling interval time, it would poll and then return to block until a new event notification arrived. I believe this would give me the ability to get events more quickly but also provide a fallback mechanism in case new event publish notifications get lost.
I don’t have anything setup like this currently so if there are other options/ideas for me to explore I’d appreciate pointers to resources for handling something like this.