2 ms·
(I worked on the same team as bkrausz, elsewhere on this thread, albeit not concurrently). Yes, this is pretty much the right thing to do. It can be a bit more
by rattray 5y ago
(I worked on the same team as bkrausz, elsewhere on this thread, albeit not concurrently).
Yes, this is pretty much the right thing to do. It can be a bit more work for the API consumer, partly because they need to track state of their last-read ID, and there's more moving parts.
If you're building a webhhook+events system like Stripe's, you might consider adding an option for a mostly-empty webhook body, which can speed things up in this use-case, but still allows "the easy way" of just processing the event from within the webhook body.
(For readers thinking of implementing this, note that "query for new data" means hitting a dedicated /events api, not individual tables, which might have unpleasant load/performance consequences).