{"action":"created","issue":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/708","repository_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/708/labels{/name}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/708/comments","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/708/events","html_url":"https://github.com/spring-cloud/spring-cloud-stream/issues/708","id":187661688,"number":708,"title":"Support dynamic multiple Output channels","user":{"login":"raissi","id":3070539,"avatar_url":"https://avatars.githubusercontent.com/u/3070539?v=3","gravatar_id":"","url":"https://api.github.com/users/raissi","html_url":"https://github.com/raissi","followers_url":"https://api.github.com/users/raissi/followers","following_url":"https://api.github.com/users/raissi/following{/other_user}","gists_url":"https://api.github.com/users/raissi/gists{/gist_id}","starred_url":"https://api.github.com/users/raissi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raissi/subscriptions","organizations_url":"https://api.github.com/users/raissi/orgs","repos_url":"https://api.github.com/users/raissi/repos","events_url":"https://api.github.com/users/raissi/events{/privacy}","received_events_url":"https://api.github.com/users/raissi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-07T09:26:17Z","updated_at":"2016-11-07T14:09:59Z","closed_at":"2016-11-07T14:04:41Z","body":"We want the output channels to be dynamically defined in config files. A good use case would be to have a kind of dispatcher application that receives messages or calls, and based on some conditions it will post messages to dynamically configured output channels (e.g: Kafka Topics).\r\nActually, in _Spring Cloud Stream_, output channels must be hardcoded by mapping each output to a given annotated method:\r\n```java\r\n@Output\r\nMessageChannel foo();\r\n```\r\nSo each time we want to add a new output channel, the code of the application must be changed and redeployed. Contrary to _input_ channels that can be configured in properties files like this:\r\n```\r\nspring.cloud.stream.bindings.input.destination=firstQueue, secondQueue\r\n```\r\nSo, our suggestion, is to define a new annotation _Outputs_ that takes a list of the names of configured output channels, like this:\r\n```\r\nspring.cloud.stream.bindings.output1.destination=someQueue.4\r\nspring.cloud.stream.bindings.output2.destination=someQueue.5\r\n\r\nmy.list.of.output.channels=output1,output2\r\n```\r\nAnd in the binding interface:\r\n```\r\n@Outputs(\"${my.list.of.output.channels}\")\r\nMessageChannel multipleOutput(String name);\r\n```\r\nThe param _name_ passed to _multipleOutput_ is the one that will determine which channel to use.\r\nThe annotation should accept hard coded names: _@Outputs(\"output1,output2\")_ but there is no great gain in this case (since the outputs are hardcoded)"},"comment":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/comments/258844588","html_url":"https://github.com/spring-cloud/spring-cloud-stream/issues/708#issuecomment-258844588","issue_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/708","id":258844588,"user":{"login":"markfisher","id":140784,"avatar_url":"https://avatars.githubusercontent.com/u/140784?v=3","gravatar_id":"","url":"https://api.github.com/users/markfisher","html_url":"https://github.com/markfisher","followers_url":"https://api.github.com/users/markfisher/followers","following_url":"https://api.github.com/users/markfisher/following{/other_user}","gists_url":"https://api.github.com/users/markfisher/gists{/gist_id}","starred_url":"https://api.github.com/users/markfisher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markfisher/subscriptions","organizations_url":"https://api.github.com/users/markfisher/orgs","repos_url":"https://api.github.com/users/markfisher/repos","events_url":"https://api.github.com/users/markfisher/events{/privacy}","received_events_url":"https://api.github.com/users/markfisher/received_events","type":"User","site_admin":false},"created_at":"2016-11-07T14:09:59Z","updated_at":"2016-11-07T14:09:59Z","body":"+1 for adding a section to the reference manual to cover this use-case"}}
{"actor":{"display_login":"markfisher"}}