3

How do the big price comparison services allow to send emails directly if the price of a product meets your targeted price.

They will email you automatically.

Is it a cron job that scans a table, or is it something compounded into the database?

3 Answers 3

1

Cron jobs would be a possibillity - an other way would be an event based solution.

Whenever a the price for a certain product is changed (there could be other events also, eg. product sold out ...) - there could be a lookup in a table where limitprices for products are stored - when the condition is met - send an email ..

You could realize it within the database (triggers, stored procedures). But as we try to minimize the logic within the database - we do it in the application server ...

1
  • How would the trigger send the email? In MySQL
    – Ryan
    Jun 20, 2011 at 5:44
0

Obviously, different sites may implement the functionality differently.

Most of the time, though, there will be a job that matches the recent price changes against the list of subscribed users. This could be done as part of the loading of a new set of prices but would more often be done asynchronously to the load process. The bigger the site, the more subscriptions, and the more timely the alerts need to be, the more likely that it would be worthwhile to cache both the subscriptions and the recent changes and to implement a custom notification module.

0

Generally, I would stay away from keeping such logic in the database. A cron job is a good option but if you are using a web framework, most likely there will be some sort of infrastructure and helper classes to invoke particular methods/logic at specified times or intervals. Actions triggered by the database pose risks especially when it is something as sensitive as sending an email to valuable customers.

I don't know how full proof you pricing update system is but if you erroneously update pricing in database which then sends emails to customers, they would not be happy to find out that the new Anthony Weiner bobble-head is not really selling for the price specified in the email. :) In that case you need a cool down period after prices are updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.