krowinski / php-mysql-replication

Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
MIT License
323 stars 98 forks source link

How can support concurrent? #82

Closed huangdijia closed 3 years ago

huangdijia commented 3 years ago

Run php-mysql-replication in swoole, I want consume events with concurrent, Can I do it like this?

// src/MySQLReplication/MySQLReplicationFactory.php:113

use Swoole\Coroutine;

    public function run(): void
    {
        while (1) {
            Coroutine::create(function () {
                $this->consume();
            });
        }
    }