Home > Archive > MySQL Server Forum > November 2005 > MySQL queue/messaging









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MySQL queue/messaging
kdemanawa@gmail.com

2005-11-24, 11:23 am

Hi.

I would like to implementation an application that will connect to a
MySQL DB and just monitor a table if a new row is being inserted. If a
new row was inserted a sub_method will be triggered. Otherwise, the
application will just be idle. Can this be done with MySQL?

Thanks!

Bill Karwin

2005-11-24, 8:23 pm

kdemanawa@gmail.com wrote:
> Hi.
>
> I would like to implementation an application that will connect to a
> MySQL DB and just monitor a table if a new row is being inserted. If a
> new row was inserted a sub_method will be triggered. Otherwise, the
> application will just be idle. Can this be done with MySQL?


MySQL has no event mechanism. You could have the client application
that performs the insert notify other clients. Or you could have the
monitoring client check periodically for new records, sleeping in
between. This is sometimes called "polling".

If the table it is monitoring has a lot of records, checking for new
entries is costly, so it might be better for the client that does the
insert to also post a record to a separate table, to indicate that a new
record has been added. The monitoring client watches this table, and
delete records as it processes them. This keeps the table shorter, and
therefore polling it is less costly.

Regards,
Bill K.
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com