11

I have a system that reprocesses some code in some rare cases when a database transaction cannot be committed.

This can create situations where a call to our Mandrill API to send e-mails can be duplicated.

I was wondering if Mandrill had a way to identify each request? Ideally, I am looking for something exactly similar to Stripe's implementation of idempotent.

Thanks!

Nawaz
  • 353,942
  • 115
  • 666
  • 851
lfboulanger
  • 2,140
  • 2
  • 17
  • 20
  • 3
    I would think you could create a unique id on your end and send this as metadata in your message. You could check Mandrill to see if has sent a message with that unique id, if not then send the message. https://mandrillapp.com/api/docs/messages.JSON.html#method=search – Scott Gottreu Apr 15 '15 at 20:28
  • 1
    Hi, I just tried this and unfortunately it seems the search api uses some kind of index and it takes a couple of minutes for the information to show up... – lfboulanger Apr 20 '15 at 18:09
  • there is outbound->rules but its lacking functionality to support this – Nimrod007 Aug 09 '15 at 08:38
  • 2
    @lfboulanger Did you manage to come up with a valid solution for this? – GFoley83 Sep 28 '15 at 22:18
  • 2
    Unfortunately not. Here is the official response from Mandrill: "...We unfortunately don't directly offer any sort of de-duplication or idempotency of emails (though we'll only send what's indicated in your requests/messages). Generally, since the logic of when to send an email, and to whom, is managed before emails get to Mandrill, that's where any desired de-duplication would need to take place. Since many of our users are sending in response to user actions or requests, or even for internal error log information, it may not make sense to stop duplicate emails." – lfboulanger Oct 01 '15 at 12:58
  • 1
    @GFoley83 I think they could still support it as an option though... but I didn't push back and argue with them. – lfboulanger Oct 01 '15 at 13:02
  • @ScottGottreu it'd be pretty hard to make the approach you described reliable, what with the race conditions it implies and the significant possibility that the result you get from Mandrill will be stale. – Valentin Waeselynck Sep 06 '16 at 16:55

0 Answers0