MySQL queue/messaging

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kdemanawa@gmail.com

    MySQL queue/messaging

    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

    #2
    Re: MySQL queue/messaging

    kdemanawa@gmail .com wrote:[color=blue]
    > 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?[/color]

    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.

    Comment

    Working...