It depends on your data volume and timeline... lots of alarms set out 12
months mean you have a huge churn just to keep state.  And you'll have to
use the task-name trick to prevent tasks which execute twice (they do
sometimes) from re-enlisting a second future task, otherwise you will end
up with people getting multiple alarms.

Also, what happens when you want to kill an alarm or reset its date?
 Keeping state in the task queue is a PITA.  What if you want to ask "has
the Alarm been fired" or "how many alarms are pending"?

Life is much simpler if you just store an Alarm object.  With the minimum
indexes, it ends up being maybe 10 datastore write ops per alarm lifetime.
 So 100,000 alarms (not counting actual work like email delivery) costs you
$1.  This is not something to lose sleep over.

Jeff

On Mon, Mar 5, 2012 at 10:54 AM, ale <aleee...@gmail.com> wrote:

> This was like my first idea, and I think that will work. My doubt was
> about the use of the resource...
> I think that using task queue (as suggested by Ian Marshall) is less
> expansive than a cron job...
> Are you agree?
>
> Thanks
> Alessandro
>
>
>
>
> On Monday, March 5, 2012 4:19:04 PM UTC+1, Jeff Schnitzer wrote:
>
>> When you set the alarm you want to create an Alarm object in the
>> datastore somewhere.  Have a cron that queries this table by date every
>> minute.  When it finds an entity, send the email and delete the Alarm.
>>
>> You need to record some way of recognizing when specific Alarms have been
>> sent; you can't always guarantee that cron executes on schedule or that
>> clocks are not skewed by some random number of minutes.  The natural way to
>> do this is by creating/deleting an object.
>>
>> Jeff
>>
>> On Sun, Mar 4, 2012 at 9:10 AM, ale <ale.....@gmail.com> wrote:
>>
>>> Hi everybody,Hello
>>> I'm writing an application that works as a calendar online (like google
>>> calendar).
>>> My question is: if a user sets an event to an hour, and I wanted to put an
>>> alarm to alert him (eg an email), how can I do ?
>>> I save the date of the event in a table, then
>>> I put up a task that checks every minute, and if the corret hour and send
>>> him the mail? There are better ways?
>>>
>>> thanks a lot!
>>> Alessandro
>>>
>>> --
>>>
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine-java/-/k0jLG8FQL8QJ.
>
> To post to this group, send email to
> google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to