evendis / mandrill-rails

Webhook processing and event decoration to make using Mandrill with Rails just that much easier
MIT License
288 stars 36 forks source link

Question about processing the payload #38

Open echan00 opened 8 years ago

echan00 commented 8 years ago

I'm currently processing the payload via background processing (such as delayedjobs) even though the processing is very minimal. Is this the right way to go about it?

Also, what happens if there are many events coming from Mandrill? Is it smarter to batch the events to process them multiple at a time? If so, would love a few pointers.

tardate commented 8 years ago

Hi @echan00

I don't know if there are any hard and fast rules here .. a lot probably depends on your mail volumes, your server infrastructure, and the complexity of the mail processing you required.

However I can say that for all the deployments I've used mandrill webhooks (range from low to 10k messages/day):

This keeps things clean and decomposed, and I've yet to hit any case/issues that would make me think about optimising this by trying to batch multiple events in one background job.

And bearing in mind that Mandrill has complete discretion over whether it's going to send you 1,2,.. 10 or 100's of events in a single webhook call - regardless of how much mail you are sending - it is quite a hairy proposition to contemplate an optimisation that pre-supposes multiple events coming in as a single POST from mandrill.

echan00 commented 8 years ago

Thanks @tardate, very useful information.

I did not know that Mandrill may send more than 1 event in a single webhook call. But good to know. I suppose since this gem already breaks down a call into multiple events, not much can be done anyways. Thanks again.