Event publish/subscribe system using database

Hi,

I need to implment an event subscribe/publish system. The observer pattern would be ideal but I don’t like the idea of having to ramp up the whole event system when the event actually occurs. With something like java you can have your event system in memory all the time but PHP being stateless I don’t really want to do that.

I was thinking of using a database table to write all events to and then having a cronjob that runs very regularly (say every 30 secs) that can then do the publishing. Any thoughts on this? Is the observer pattern still applicable with this implementation?

Thanks
Ziad

I believe the observer pattern code still be implemented like this, though I’ve no idea (and no experience) throwing the database into that mix. Performance is a possible area of concern, though I don’t know for sure. If you try it, I would definitely do a little performance testing to see what it’s like.