mendicant-original / newman

Newman: a microframework for building email-based applications.
116 stars 11 forks source link

other response models - broadcast, no response, delayed response etc. #5

Closed ericgj closed 12 years ago

ericgj commented 12 years ago

Right now the server model is single-request, single-response. It's easy to think of other use-cases that don't fit this model: for instance

  1. broadcast 'mail-merge' emails,
  2. email that just sends a command and doesn't need any response,
  3. response emails get queued up or combined for later delivery, e.g. 'digest' emails might work this way

None of these seem high priority for us, in fact I'd be happy never to build a platform for spam (#1) :)

But something to consider at some point whether the app should have more control over the response flow, rather than the server.

practicingruby commented 12 years ago

I agree, the "one request, one response" model has its limitations. That said, I'm still trying to hit them head on via a real use case rather than conduct thought experiments to influence the design. Still, the scenarios you brought up are worth discussing.

1) I'm not interested in that use case. Using Mail gem directly seems to solve that problem, or just using Newmail::Mailer.deliver_mail if you wanted to piggyback off of Newman's configuration system.

2) I can't think of a practical example, do you have one?

3) I think this can be done if you make it so the application is essentially just a capturing mechanism, and then stores the data in a Newman::Store. Then, a cron job could fire a script which uses a combination of Newman::Mailer and Newman::Store to generate the digest. That may well be cumbersome, and building it may teach us how to improve the underlying system.

practicingruby commented 12 years ago

Closing and marking as a design issue, will re-open if we come across a clear solution to these problems.

ericgj commented 12 years ago

Examples for 2),

None of them significant enough to worry about now, I agree.

practicingruby commented 12 years ago

I wanted to have something like a skip_response which would disable mail delivery. It sounds like this is something that may solve all the issues you outlined, and I don't think it will be that hard to implement. What do you think?

ericgj commented 12 years ago

Yes, exactly where I was headed. if you want I could have a crack at that too.

practicingruby commented 12 years ago

Go for it. I'll open a ticket an assign it to you.