{"action":"created","issue":{"url":"https://api.github.com/repos/shyiko/mysql-binlog-connector-java/issues/32","labels_url":"https://api.github.com/repos/shyiko/mysql-binlog-connector-java/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/shyiko/mysql-binlog-connector-java/issues/32/comments","events_url":"https://api.github.com/repos/shyiko/mysql-binlog-connector-java/issues/32/events","html_url":"https://github.com/shyiko/mysql-binlog-connector-java/issues/32","id":63058834,"number":32,"title":"How EventListener#onEvent is executed?","user":{"login":"ngocdaothanh","id":10095,"avatar_url":"https://avatars.githubusercontent.com/u/10095?v=3","gravatar_id":"","url":"https://api.github.com/users/ngocdaothanh","html_url":"https://github.com/ngocdaothanh","followers_url":"https://api.github.com/users/ngocdaothanh/followers","following_url":"https://api.github.com/users/ngocdaothanh/following{/other_user}","gists_url":"https://api.github.com/users/ngocdaothanh/gists{/gist_id}","starred_url":"https://api.github.com/users/ngocdaothanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngocdaothanh/subscriptions","organizations_url":"https://api.github.com/users/ngocdaothanh/orgs","repos_url":"https://api.github.com/users/ngocdaothanh/repos","events_url":"https://api.github.com/users/ngocdaothanh/events{/privacy}","received_events_url":"https://api.github.com/users/ngocdaothanh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-19T18:30:22Z","updated_at":"2015-03-20T05:55:42Z","closed_at":null,"body":"This may be related to #15.\r\n\r\nI think readme.md should mention how `EventListener#onEvent` is executed.\r\n\r\nIs it executed by the network IO thread of mysql-binlog-connector-java? If I have a blocking logic inside `onEvent`, will it cause mysql-binlog-connector-java to stop reading new binlog events? Should I run my logic in separate thread that I manage on my own?\r\n\r\nI want to write a high performance data replicator, so I don't want to block mysql-binlog-connector-java from reading new binlog events while my replicator logic runs."},"comment":{"url":"https://api.github.com/repos/shyiko/mysql-binlog-connector-java/issues/comments/83922033","html_url":"https://github.com/shyiko/mysql-binlog-connector-java/issues/32#issuecomment-83922033","issue_url":"https://api.github.com/repos/shyiko/mysql-binlog-connector-java/issues/32","id":83922033,"user":{"login":"shyiko","id":370176,"avatar_url":"https://avatars.githubusercontent.com/u/370176?v=3","gravatar_id":"","url":"https://api.github.com/users/shyiko","html_url":"https://github.com/shyiko","followers_url":"https://api.github.com/users/shyiko/followers","following_url":"https://api.github.com/users/shyiko/following{/other_user}","gists_url":"https://api.github.com/users/shyiko/gists{/gist_id}","starred_url":"https://api.github.com/users/shyiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shyiko/subscriptions","organizations_url":"https://api.github.com/users/shyiko/orgs","repos_url":"https://api.github.com/users/shyiko/repos","events_url":"https://api.github.com/users/shyiko/events{/privacy}","received_events_url":"https://api.github.com/users/shyiko/received_events","type":"User","site_admin":false},"created_at":"2015-03-20T05:55:42Z","updated_at":"2015-03-20T05:55:42Z","body":"Hi. \r\n\r\n> This may be related to #15.\r\n\r\nThat ticket is more about refactoring than anything else.\r\n\r\n> Is it executed by the network IO thread of mysql-binlog-connector-java?\r\n\r\nInformation on whether separate thread is started is in javadocs ([connect](https://github.com/shyiko/mysql-binlog-connector-java/blob/master/src/main/java/com/github/shyiko/mysql/binlog/BinaryLogClient.java#L281) and [connect(timeout)](https://github.com/shyiko/mysql-binlog-connector-java/blob/master/src/main/java/com/github/shyiko/mysql/binlog/BinaryLogClient.java#L420)). `onEvent ` is always invoked within the same (original or spawned (depending on which `connect` is being used)) thread. \r\n\r\n> If I have a blocking logic inside onEvent, will it cause mysql-binlog-connector-java to stop reading new binlog events? \r\n\r\nYes. mysql-binlog-connector-java makes no assumption about how it's going to be used. It's up to the user to implement some kind of queue (hopefully with back pressure mechanism in place) if he deems necessary.\r\n\r\n> Should I run my logic in separate thread that I manage on my own?\r\n\r\nIf you want to squeeze every bit of performance (like in your case) then yes. It sure seems like it.\r\n\r\n"}}