{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka/issues/17827","labels_url":"https://api.github.com/repos/akka/akka/issues/17827/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/17827/comments","events_url":"https://api.github.com/repos/akka/akka/issues/17827/events","html_url":"https://github.com/akka/akka/issues/17827","id":90755535,"number":17827,"title":"Provide inline broadcast","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/akka/akka/labels/0%20-%20new","name":"0 - new","color":"ffffff"},{"url":"https://api.github.com/repos/akka/akka/labels/t:stream","name":"t:stream","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/akka/akka/milestones/16","html_url":"https://github.com/akka/akka/milestones/streams-1.x","labels_url":"https://api.github.com/repos/akka/akka/milestones/16/labels","id":745106,"number":16,"title":"streams-1.x","description":"","creator":{"login":"rkuhn","id":470469,"avatar_url":"https://avatars.githubusercontent.com/u/470469?v=3","gravatar_id":"","url":"https://api.github.com/users/rkuhn","html_url":"https://github.com/rkuhn","followers_url":"https://api.github.com/users/rkuhn/followers","following_url":"https://api.github.com/users/rkuhn/following{/other_user}","gists_url":"https://api.github.com/users/rkuhn/gists{/gist_id}","starred_url":"https://api.github.com/users/rkuhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkuhn/subscriptions","organizations_url":"https://api.github.com/users/rkuhn/orgs","repos_url":"https://api.github.com/users/rkuhn/repos","events_url":"https://api.github.com/users/rkuhn/events{/privacy}","received_events_url":"https://api.github.com/users/rkuhn/received_events","type":"User","site_admin":false},"open_issues":117,"closed_issues":1,"state":"open","created_at":"2014-08-06T15:08:47Z","updated_at":"2015-09-18T11:31:42Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-06-24T18:37:34Z","updated_at":"2015-09-24T01:55:46Z","closed_at":null,"body":"Sounds to me me as a pretty common case, to broadcast to multiple Sinks \"in line\".\r\n\r\nA naive implementation below:\r\n\r\n```scala\r\n  val sink = Sink.foreach[Int](i => println(\"sink: \" + i))\r\n    \r\n    Source(1 to 2)\r\n      .inlineOnComplete(_ => println(\"done\"))\r\n      .runWith(sink)\r\n\r\n    Source(1 to 2)\r\n      .inlineBroadcast(Sink.onComplete(_ => println(\"done\")))\r\n      .runWith(sink)\r\n    \r\n    implicit class OnCompletePassThrough[T](s: Source[T, Unit]) {\r\n      def inlineOnComplete(callback: Try[Unit] => Unit): Source[T, Unit] =\r\n        inlineBroadcast(Sink.onComplete(callback))\r\n\r\n      def inlineBroadcast[M](_sink: Sink[T, M]): Source[T, M] =\r\n      Source(_sink) { implicit b => sink =>\r\n        import FlowGraph.Implicits._\r\n        val m = b.add(Broadcast[T](2))\r\n        s ~> m.in\r\n        m.out(0) ~> sink\r\n        m.out(1)\r\n      }\r\n```"},"comment":{"url":"https://api.github.com/repos/akka/akka/issues/comments/142781538","html_url":"https://github.com/akka/akka/issues/17827#issuecomment-142781538","issue_url":"https://api.github.com/repos/akka/akka/issues/17827","id":142781538,"user":{"login":"agolubev","id":461456,"avatar_url":"https://avatars.githubusercontent.com/u/461456?v=3","gravatar_id":"","url":"https://api.github.com/users/agolubev","html_url":"https://github.com/agolubev","followers_url":"https://api.github.com/users/agolubev/followers","following_url":"https://api.github.com/users/agolubev/following{/other_user}","gists_url":"https://api.github.com/users/agolubev/gists{/gist_id}","starred_url":"https://api.github.com/users/agolubev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agolubev/subscriptions","organizations_url":"https://api.github.com/users/agolubev/orgs","repos_url":"https://api.github.com/users/agolubev/repos","events_url":"https://api.github.com/users/agolubev/events{/privacy}","received_events_url":"https://api.github.com/users/agolubev/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T01:55:45Z","updated_at":"2015-09-24T01:55:45Z","body":"@ktoso, actually all (ok, at least many) fan out transformations can be applied, mirroring #18411"}}