66use MySQLReplication \BinaryDataReader \BinaryDataReader ;
77use MySQLReplication \BinaryDataReader \BinaryDataReaderException ;
88use MySQLReplication \BinLog \BinLogException ;
9- use MySQLReplication \BinLog \BinLogServerInfo ;
109use MySQLReplication \BinLog \BinLogSocketConnect ;
1110use MySQLReplication \Config \Config ;
1211use MySQLReplication \Definitions \ConstEventType ;
@@ -35,7 +34,6 @@ class Event
3534 * @var Config
3635 */
3736 private $ config ;
38- private $ binLogServerInfo ;
3937
4038 public function __construct (
4139 Config $ config ,
@@ -45,13 +43,17 @@ public function __construct(
4543 CacheInterface $ cache
4644 ) {
4745 $ this ->config = $ config ;
48- $ this ->binLogServerInfo = $ binLogSocketConnect ->getBinLogServerInfo ();
4946 $ this ->binLogSocketConnect = $ binLogSocketConnect ;
5047 $ this ->rowEventFactory = $ rowEventFactory ;
5148 $ this ->eventDispatcher = $ eventDispatcher ;
5249 $ this ->cache = $ cache ;
5350 }
5451
52+ public function connect (): void
53+ {
54+ $ this ->binLogSocketConnect ->connect ();
55+ }
56+
5557 /**
5658 * @throws BinaryDataReaderException
5759 * @throws BinLogException
@@ -62,6 +64,7 @@ public function __construct(
6264 */
6365 public function consume (): void
6466 {
67+ $ binLogServerInfo = $ this ->binLogSocketConnect ->getBinLogServerInfo ();
6568 $ binaryDataReader = new BinaryDataReader ($ this ->binLogSocketConnect ->getResponse ());
6669
6770 // check EOF_Packet -> https://dev.mysql.com/doc/internals/en/packet-EOF_Packet.html
@@ -80,7 +83,7 @@ public function consume(): void
8083 $ eventDTO = $ this ->rowEventFactory ->makeRowEvent ($ binaryDataReader , $ eventInfo )->makeTableMapDTO ();
8184 } else if (ConstEventType::ROTATE_EVENT === $ eventInfo ->getType ()) {
8285 $ this ->cache ->clear ();
83- $ eventDTO = (new RotateEvent ($ this -> binLogServerInfo , $ eventInfo , $ binaryDataReader ))->makeRotateEventDTO ();
86+ $ eventDTO = (new RotateEvent ($ binLogServerInfo , $ eventInfo , $ binaryDataReader ))->makeRotateEventDTO ();
8487 } else if (ConstEventType::GTID_LOG_EVENT === $ eventInfo ->getType ()) {
8588 $ eventDTO = (new GtidEvent ($ eventInfo , $ binaryDataReader ))->makeGTIDLogDTO ();
8689 } else if (ConstEventType::HEARTBEAT_LOG_EVENT === $ eventInfo ->getType ()) {
@@ -127,7 +130,8 @@ private function createEventInfo(BinaryDataReader $binaryDataReader): EventInfo
127130
128131 private function filterDummyMariaDbEvents (QueryDTO $ queryDTO ): ?QueryDTO
129132 {
130- if ($ this ->binLogServerInfo ->isMariaDb () && false !== strpos ($ queryDTO ->getQuery (), self ::MARIADB_DUMMY_QUERY )) {
133+ if ($ this ->binLogSocketConnect ->getBinLogServerInfo ()->isMariaDb () &&
134+ false !== strpos ($ queryDTO ->getQuery (), self ::MARIADB_DUMMY_QUERY )) {
131135 return null ;
132136 }
133137
0 commit comments