event-gateway icon indicating copy to clipboard operation
event-gateway copied to clipboard

At-least-once processing for asynchronous subscriptions

Open alexdebrie opened this issue 6 years ago • 4 comments

With asynchronous subscriptions, the producing client receives a 202 Accepted once the emitted event has been committed to an internal queue. A worker then grabs the event from the queue, fetches the relevant subscriptions, and attempts to trigger the relevant functions. This setup allows for at-most-once processing but does not provide resiliency in the event of failure of the Event Gateway node.

For this ticket, we should implement at-least-once processing for asynchronous events so that a producing client can feel confident that the emitted event will be processed by downstream subscribers.

alexdebrie avatar Jun 01 '18 21:06 alexdebrie

@alexdebrie do you have any thoughts on how you would implement this?

As I read through the EG docs, I kind of expected a section explaining how EG would set up managed event queues of your favorite cloud provider behind the scenes to solve at-least-once processing. For example, if I created an event foo, EG would set up a Google PubSub topic foo and subscribe to it, feeding subscriptions created via the EG API.

This would mean that on posting an event to EG, it doesn't call the subscribed functions directly but sends the event to the associated queue. When the event comes back down from the queue, it sends it to the subscribed functions and removes it from the queue if this has been successful.

What do you think?

486 avatar Sep 07 '18 18:09 486

Hey @486, thanks for jumping it.

We've discussed this a bit internally, and that's exactly the way we're planning on handling it -- using some sort of queue to manage events to protect against Event Gateway instances dying.

We're prioritizing some other work right now, but let us know if you'd like to help with this! It's a decent chunk of work that will require some upfront design, but I'm sure @mthenw would be happy to discuss if you're interested.

alexdebrie avatar Sep 09 '18 18:09 alexdebrie

Thanks for the reponse @alexdebrie ! Glad to hear my idea is valid. I might consider it, but I have another question around the project. How can I PM you?

486 avatar Sep 09 '18 19:09 486

You're welcome! You can email me at [email protected] .

alexdebrie avatar Sep 09 '18 19:09 alexdebrie