4 ms·
This is exactly what I've been wrestling with recently.. it's so disappointingly absent in all the offerings out there. The solution I ended up with was to bui
by johtso 2y ago
This is exactly what I've been wrestling with recently.. it's so disappointingly absent in all the offerings out there.
The solution I ended up with was to build my own pseudo-idempotency around Postmark. It helps that Postmark at least has proper persistence so you can query their API to check if you've already sent a certain email. I had to move away from Mailchimp because, if an email gets queued for some reason, it isn't reflected as sent in the API so there's no way of knowing whether an email is hiding in "queued limbo". Postmark doesn't have this problem.
The only caveat is that there is a delay between sending an email and it being reflected in the API (seems pretty standard across the different services). This means I had to implement a simple database backed lock to make sure I never try to send the same email more than once in quick succession.
It's kind of ridiculous, but.. I couldn't find any alternative.
Edit:
Wonder if it would be worth wrapping something like this up into some kind of a self-hostable proxy service. You'd provide the idempotency key in a header and it would do the rest
- dandigangi 2y agoHi. Thanks for the feedback. Recently took over Postmark's engineering and interested in seeing where we can do better as we keep building.