{"action":"created","issue":{"url":"https://api.github.com/repos/twitter/tormenta/issues/68","repository_url":"https://api.github.com/repos/twitter/tormenta","labels_url":"https://api.github.com/repos/twitter/tormenta/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/twitter/tormenta/issues/68/comments","events_url":"https://api.github.com/repos/twitter/tormenta/issues/68/events","html_url":"https://github.com/twitter/tormenta/issues/68","id":171768920,"number":68,"title":"SchemeSpout doesn't handle callOnOpen properly","user":{"login":"jnievelt","id":4684038,"avatar_url":"https://avatars.githubusercontent.com/u/4684038?v=3","gravatar_id":"","url":"https://api.github.com/users/jnievelt","html_url":"https://github.com/jnievelt","followers_url":"https://api.github.com/users/jnievelt/followers","following_url":"https://api.github.com/users/jnievelt/following{/other_user}","gists_url":"https://api.github.com/users/jnievelt/gists{/gist_id}","starred_url":"https://api.github.com/users/jnievelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnievelt/subscriptions","organizations_url":"https://api.github.com/users/jnievelt/orgs","repos_url":"https://api.github.com/users/jnievelt/repos","events_url":"https://api.github.com/users/jnievelt/events{/privacy}","received_events_url":"https://api.github.com/users/jnievelt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-17T21:49:24Z","updated_at":"2016-08-17T21:53:33Z","closed_at":null,"body":"This manifests in three ways.\r\n\r\nIf we do simply:\r\n```scala\r\nval hookedSpout = schemeSpout.openHook { _ => println(\"openHook\") }\r\n```\r\nWe are given back a `BaseSpout` that is not a `SchemeSpout`, and we are back to the `poll`-based spout implementation (which, incidentally, will always be `Nil`).\r\n\r\nThis can be worked around, sort of, by using a `FlatMappedSchemeSpout`, because that implements `openHook`.  But there are problems there too.\r\n\r\nIf we have code that looks like:\r\n```scala\r\nval hookedSpout = fmSchemeSpout.openHook { _ => println(\"openHook\") }\r\nval mappedSpout = hookedSpout.flatMap { x => Some(x) }\r\n```\r\n`mappedSpout` will not honor the hook, because there is no default implementation in `FlatMappedSchemeSpout` for `callOnOpen`.\r\n\r\nFurthermore, code like this:\r\n```scala\r\nval hookedSpout = fmSchemeSpout.openHook { _ => println(\"openHook\") }\r\nval mappedSpout = hookedSpout.flatMap { x => Some(x) }\r\nval hookedSpout2 = mappedSpout.openHook { _ => println(\"openHook2\") }\r\nval hookedSpout3 = hookedSpout2.openHook { _ => println(\"openHook3\") }\r\n```\r\n`hookedSpout3` will now honor the first hook, and the third, but not the second."},"comment":{"url":"https://api.github.com/repos/twitter/tormenta/issues/comments/240561007","html_url":"https://github.com/twitter/tormenta/issues/68#issuecomment-240561007","issue_url":"https://api.github.com/repos/twitter/tormenta/issues/68","id":240561007,"user":{"login":"jnievelt","id":4684038,"avatar_url":"https://avatars.githubusercontent.com/u/4684038?v=3","gravatar_id":"","url":"https://api.github.com/users/jnievelt","html_url":"https://github.com/jnievelt","followers_url":"https://api.github.com/users/jnievelt/followers","following_url":"https://api.github.com/users/jnievelt/following{/other_user}","gists_url":"https://api.github.com/users/jnievelt/gists{/gist_id}","starred_url":"https://api.github.com/users/jnievelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnievelt/subscriptions","organizations_url":"https://api.github.com/users/jnievelt/orgs","repos_url":"https://api.github.com/users/jnievelt/repos","events_url":"https://api.github.com/users/jnievelt/events{/privacy}","received_events_url":"https://api.github.com/users/jnievelt/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T21:53:32Z","updated_at":"2016-08-17T21:53:32Z","body":"It seems like there are two ways generally around this.  First, we could simply add proper `openHook` implementations to `SchemeSpout` and `FlatMappedSchemeSpout`.\r\n\r\nBut perhaps it makes sense to implement a sort of `SchemeSpout` proxy, on which we can override the relevant calls?  Fixing this issue would be a fairly straightforward part of that change."}}
{"actor":{"display_login":"jnievelt"}}