MySQL queue/messaging

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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?


Re: MySQL queue/messaging wrote:
Quoted text here. Click to load it

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.

Bill K.

Site Timeline