/**
  * @param Config $config
  * @throws MySQLReplicationException
  * @throws DBALException
  * @throws ConfigException
  * @throws BinLogException
  */
 public function __construct(Config $config)
 {
     $config->validate();
     $this->connection = DriverManager::getConnection(['user' => $config->getUser(), 'password' => $config->getPassword(), 'host' => $config->getHost(), 'port' => $config->getPort(), 'driver' => 'pdo_mysql', 'charset' => $config->getCharset()]);
     $this->repository = new MySQLRepository($this->connection);
     $this->gtiService = new GtidService();
     $this->binLogAuth = new BinLogAuth();
     $this->socketConnect = new BinLogSocketConnect($config, $this->repository, $this->binLogAuth, $this->gtiService);
     $this->socketConnect->connectToStream();
     $this->jsonBinaryDecoderFactory = new JsonBinaryDecoderFactory();
     $this->rowEventService = new RowEventService($config, $this->repository, $this->jsonBinaryDecoderFactory);
     $this->binaryDataReaderService = new BinaryDataReaderService();
     $this->eventDispatcher = new EventDispatcher();
     $this->event = new Event($config, $this->socketConnect, $this->binaryDataReaderService, $this->rowEventService, $this->eventDispatcher);
 }