开发者

How do I implement a periodic digest of messages?

My system sends out messages to users (email, sms, etc). It currently sends it for every event (which is only once a day at most), but I'd like to add in a form of digest to it where a user can select to have a weekly or monthly digest of their messages. I'm looking to see if there are any existing opensource solutions for this, or existing patterns for implementing something like this.

My system does not persist any of the messages, they are sent out on an as needed basis and then forgotten. So that is the first thing that will 开发者_运维百科need to happen. I'd also like to be able to create a message page on the site that will display a history of all messages.

Then there needs to be the mechanism that looks at the user preference on messages and decides when to send the messages and how to group them up into a digest form if needed.

Any pointers or thoughts would be appreciated.


Store messages generically in a database with a categorization schema like (this is pseudocode):

TABLE message {
 id,
 created_timestamp,
 user_id,
 sent,
 type (sms, email, etc),
 content
}

Then, everyday at say midnight, SELECT out all messages where sent = 0 and user_id = and aggregate them up into a single message, send it via the specified type's method, and mark it all as sent = 1.

You'd be able to look up a historical message set by just SELECTing out messages where sent = 1.


If you're willing to spend money, good old Listserv v16 does this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜