Instead of using a database table as an intermediary you should take a
look at using an actual message queue.  I'm personally using
BeanstalkD with the BeanstalkC python module.

When a new message is created, you could create a bit of JSON that
contains the message and the list of recipients.  Then you would have
a python worker process script that would wait for new messages and it
would take care of actually sending the email/sms.

http://kr.github.com/beanstalkd
https://github.com/earl/beanstalkc

Matt

On May 9, 6:13 am, villas <villa...@gmail.com> wrote:
> I once set something up with this kind of functionality.  Simplified
> concept was:
>
> 1. Two tables, e.g.:
>   Messages: subject, body
>   MessQueue: to_id, from_id, message_id, dest, stat, sent_on
>     note: dest is either an email address or mobile tel no.
>
> 2. A message is created and multiple recipients chosen. For each
> recipient an entry is made in the messqueue table.
>
> 3. A background script (outside web2py) polls the messqueue and sends
> message via email or text message. Result is stored in stat field.
>
> 4. In addition to receiving the messages via email/text, each user can
> see a list of their messages when they log on.
>
> On May 8, 10:22 pm, Pystar <aitoehi...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi all,
> > In the app I am developing I want to include messaging which would
> > allow users to send messages to single users or make a broadcast to
> > multiple users. I have a database for the messages which for now would
> > only be simple text, no video or pictures. I would like to know the
> > best way I can go about implementing this. For now, this is how I
> > think it should work, the user composes the message and sends it, the
> > message is inserted into the "messages table" of the sender and also
> > inserted into the messages table of the recipient/recipients.
> > I have some misgivings about this, because if the number of recipients
> > are very many, that means alot of INSERTS would be done which might
> > bog down my server. I have been thinking about using a MESSAGE QUEUE
> > for this.
>
> > I need advice/tips. I am stuck

Reply via email to