{"action":"created","comment":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/comments/38339017","id":38339017,"diff_hunk":"@@ -92,6 +121,73 @@ public void launch(List<ModuleLaunchRequest> moduleLaunchRequests) {\n \t\treturn result;\n \t}\n \n+\tpublic void aggregateAndLaunchModules(List<ModuleLaunchRequest> moduleLaunchRequests, final String[] parentArgs) {\n+\t\ttry {\n+\t\t\tList<String> mainClassNames = new ArrayList<>();\n+\t\t\tList<URL> jarURLs = new ArrayList<>();\n+\t\t\tList<String> seenArchives = new ArrayList<>();\n+\t\t\tfinal List<String[]> arguments = new ArrayList<>();\n+\t\t\t// aggregate jars from all modules and extract their main Classes\n+\t\t\tfor (ModuleLaunchRequest moduleLaunchRequest : moduleLaunchRequests) {\n+\t\t\t\tResource resource = resolveModule(moduleLaunchRequest.getModule());\n+\t\t\t\tJarFileArchive jarFileArchive = new JarFileArchive(resource.getFile());\n+\t\t\t\tjarURLs.add(jarFileArchive.getUrl());\n+\t\t\t\tfor (Archive archive : jarFileArchive.getNestedArchives(ArchiveMatchingEntryFilter.FILTER)) {\n+\t\t\t\t\t// avoid duplication based on unique JAR names\n+\t\t\t\t\t// TODO - read the metadata from the JARs, do proper version resolution on merge\n+\t\t\t\t\tString urlAsString = archive.getUrl().toString();\n+\t\t\t\t\tString jarNameWithExtension = urlAsString.substring(0, urlAsString.lastIndexOf(\"!/\"));\n+\t\t\t\t\tString jarNameWithoutExtension = jarNameWithExtension.substring(jarNameWithExtension.lastIndexOf(\"/\") + 1);\n+\t\t\t\t\tif (!seenArchives.contains(jarNameWithoutExtension)) {\n+\t\t\t\t\t\tseenArchives.add(jarNameWithoutExtension);\n+\t\t\t\t\t\tjarURLs.add(archive.getUrl());\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tmainClassNames.add(jarFileArchive.getMainClass());\n+\t\t\t\targuments.add(toArgArray(moduleLaunchRequest.getArguments()));\n+\t\t\t}\n+\t\t\tfinal ClassLoader classLoader = new LaunchedURLClassLoader(jarURLs.toArray(new URL[jarURLs.size()]),\n+\t\t\t\t\tClassloaderUtils.getExtensionClassloader());\n+\t\t\tfinal List<Class<?>> mainClasses = new ArrayList<>();\n+\t\t\tfor (String mainClass : mainClassNames) {\n+\t\t\t\tmainClasses.add(ClassUtils.forName(mainClass, classLoader));\n+\t\t\t}\n+\t\t\tRunnable moduleAggregatorRunner = new Runnable() {\n+\t\t\t\t@Override\n+\t\t\t\tpublic void run() {\n+\t\t\t\t\ttry {\n+\t\t\t\t\t\t// we expect the class and method to be found on the module classpath\n+\t\t\t\t\t\tClass<?> moduleAggregatorClass = ClassUtils.forName(MODULE_AGGREGATOR_CLASS, classLoader);\n+\t\t\t\t\t\tMethod aggregateMethod = ReflectionUtils.findMethod(moduleAggregatorClass,\n+\t\t\t\t\t\t\t\tMODULE_AGGREGATOR_METHOD, String[].class, Class[].class, String[][].class);\n+\t\t\t\t\t\taggregateMethod.invoke(null,\n+\t\t\t\t\t\t\t\tparentArgs,\n+\t\t\t\t\t\t\t\tmainClasses.toArray(new Class<?>[mainClasses.size()]) ,\n+\t\t\t\t\t\t\t\targuments.toArray(new String[][]{}));\n+\t\t\t\t\t} catch (Exception e) {\n+\t\t\t\t\t\tlog.error(\"Cannot start module group \", e);","path":"spring-cloud-stream-module-launcher/src/main/java/org/springframework/cloud/stream/module/launcher/ModuleLauncher.java","position":126,"original_position":126,"commit_id":"cd8270c4645973f8cddd9b21f64bc2f01109830d","original_commit_id":"cd8270c4645973f8cddd9b21f64bc2f01109830d","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},"body":"would change error message to \"failed to start aggregated modules\" (rather than use the word \"group\" here)","created_at":"2015-08-31T17:57:29Z","updated_at":"2015-08-31T17:57:29Z","html_url":"https://github.com/spring-cloud/spring-cloud-stream/pull/113#discussion_r38339017","pull_request_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113","_links":{"self":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/comments/38339017"},"html":{"href":"https://github.com/spring-cloud/spring-cloud-stream/pull/113#discussion_r38339017"},"pull_request":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113"}}},"pull_request":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113","id":43673326,"html_url":"https://github.com/spring-cloud/spring-cloud-stream/pull/113","diff_url":"https://github.com/spring-cloud/spring-cloud-stream/pull/113.diff","patch_url":"https://github.com/spring-cloud/spring-cloud-stream/pull/113.patch","issue_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/113","number":113,"state":"open","locked":false,"title":"Channel proxies direct binding","user":{"login":"mbogoevici","id":159684,"avatar_url":"https://avatars.githubusercontent.com/u/159684?v=3","gravatar_id":"","url":"https://api.github.com/users/mbogoevici","html_url":"https://github.com/mbogoevici","followers_url":"https://api.github.com/users/mbogoevici/followers","following_url":"https://api.github.com/users/mbogoevici/following{/other_user}","gists_url":"https://api.github.com/users/mbogoevici/gists{/gist_id}","starred_url":"https://api.github.com/users/mbogoevici/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbogoevici/subscriptions","organizations_url":"https://api.github.com/users/mbogoevici/orgs","repos_url":"https://api.github.com/users/mbogoevici/repos","events_url":"https://api.github.com/users/mbogoevici/events{/privacy}","received_events_url":"https://api.github.com/users/mbogoevici/received_events","type":"User","site_admin":false},"body":"- Remove DirectChannelProxyFactory;\r\n- Proxies create channels as necessary, including support for PollableChannels;\r\n- Channel beans are using the bean factory methods for the proxies;\r\n- Coordinate bind/unbind across a context through the internal Bindable interface;\r\n- Add support for embedding modules as independent child contexts of the main module, wrapped in a Bindable interface;\r\n- Add support for channel name namespacing;\r\n- Use a shared channel registry (consulted by the proxies) to create direct bindings;\r\n\r\nTest by installing spring-cloud-stream and spring-cloud-stream-modules and then running similar to\r\n\r\njava -jar spring-cloud-stream-module-launcher/target/spring-cloud-stream-module-launcher-1.0.0.BUILD-SNAPSHOT.jar --modules=org.springframework.cloud.stream.module:time-source:1.0.0.BUILD-SNAPSHOT,org.springframework.cloud.stream.module:filter-processor:1.0.0.BUILD-SNAPSHOT,org.springframework.cloud.stream.module:filter-processor:1.0.0.BUILD-SNAPSHOT --args.0.fixedDelay=7 --args.1.expression='payload.contains(\"6\")' --aggregate=true --spring.cloud.stream.bindings.output=filtered\r\n\r\nNote that the target queue should be 'filtered' and that the module parameters are applied correctly","created_at":"2015-08-28T21:20:06Z","updated_at":"2015-08-31T17:57:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d1cf8f2724e2cb696e3823337745135c694c8ca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113/commits","review_comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113/comments","review_comment_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/113/comments","statuses_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/statuses/cd8270c4645973f8cddd9b21f64bc2f01109830d","head":{"label":"mbogoevici:channel-proxies-direct-binding","ref":"channel-proxies-direct-binding","sha":"cd8270c4645973f8cddd9b21f64bc2f01109830d","user":{"login":"mbogoevici","id":159684,"avatar_url":"https://avatars.githubusercontent.com/u/159684?v=3","gravatar_id":"","url":"https://api.github.com/users/mbogoevici","html_url":"https://github.com/mbogoevici","followers_url":"https://api.github.com/users/mbogoevici/followers","following_url":"https://api.github.com/users/mbogoevici/following{/other_user}","gists_url":"https://api.github.com/users/mbogoevici/gists{/gist_id}","starred_url":"https://api.github.com/users/mbogoevici/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbogoevici/subscriptions","organizations_url":"https://api.github.com/users/mbogoevici/orgs","repos_url":"https://api.github.com/users/mbogoevici/repos","events_url":"https://api.github.com/users/mbogoevici/events{/privacy}","received_events_url":"https://api.github.com/users/mbogoevici/received_events","type":"User","site_admin":false},"repo":{"id":38768510,"name":"spring-cloud-stream","full_name":"mbogoevici/spring-cloud-stream","owner":{"login":"mbogoevici","id":159684,"avatar_url":"https://avatars.githubusercontent.com/u/159684?v=3","gravatar_id":"","url":"https://api.github.com/users/mbogoevici","html_url":"https://github.com/mbogoevici","followers_url":"https://api.github.com/users/mbogoevici/followers","following_url":"https://api.github.com/users/mbogoevici/following{/other_user}","gists_url":"https://api.github.com/users/mbogoevici/gists{/gist_id}","starred_url":"https://api.github.com/users/mbogoevici/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbogoevici/subscriptions","organizations_url":"https://api.github.com/users/mbogoevici/orgs","repos_url":"https://api.github.com/users/mbogoevici/repos","events_url":"https://api.github.com/users/mbogoevici/events{/privacy}","received_events_url":"https://api.github.com/users/mbogoevici/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mbogoevici/spring-cloud-stream","description":"Messaging Microservices with Spring Integration","fork":true,"url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream","forks_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/forks","keys_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/teams","hooks_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/hooks","issue_events_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/issues/events{/number}","events_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/events","assignees_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/assignees{/user}","branches_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/branches{/branch}","tags_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/tags","blobs_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/git/refs{/sha}","trees_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/statuses/{sha}","languages_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/languages","stargazers_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/stargazers","contributors_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/contributors","subscribers_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/subscribers","subscription_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/subscription","commits_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/commits{/sha}","git_commits_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/git/commits{/sha}","comments_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/comments{/number}","issue_comment_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/issues/comments{/number}","contents_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/contents/{+path}","compare_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/merges","archive_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/downloads","issues_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/issues{/number}","pulls_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/pulls{/number}","milestones_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/milestones{/number}","notifications_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/labels{/name}","releases_url":"https://api.github.com/repos/mbogoevici/spring-cloud-stream/releases{/id}","created_at":"2015-07-08T17:15:48Z","updated_at":"2015-07-17T11:12:02Z","pushed_at":"2015-08-31T16:08:49Z","git_url":"git://github.com/mbogoevici/spring-cloud-stream.git","ssh_url":"git@github.com:mbogoevici/spring-cloud-stream.git","clone_url":"https://github.com/mbogoevici/spring-cloud-stream.git","svn_url":"https://github.com/mbogoevici/spring-cloud-stream","homepage":null,"size":1112,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spring-cloud:master","ref":"master","sha":"b60ccd142767c54a3fd889630edfd27b31d51868","user":{"login":"spring-cloud","id":7815877,"avatar_url":"https://avatars.githubusercontent.com/u/7815877?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-cloud","html_url":"https://github.com/spring-cloud","followers_url":"https://api.github.com/users/spring-cloud/followers","following_url":"https://api.github.com/users/spring-cloud/following{/other_user}","gists_url":"https://api.github.com/users/spring-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-cloud/subscriptions","organizations_url":"https://api.github.com/users/spring-cloud/orgs","repos_url":"https://api.github.com/users/spring-cloud/repos","events_url":"https://api.github.com/users/spring-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/spring-cloud/received_events","type":"Organization","site_admin":false},"repo":{"id":38764029,"name":"spring-cloud-stream","full_name":"spring-cloud/spring-cloud-stream","owner":{"login":"spring-cloud","id":7815877,"avatar_url":"https://avatars.githubusercontent.com/u/7815877?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-cloud","html_url":"https://github.com/spring-cloud","followers_url":"https://api.github.com/users/spring-cloud/followers","following_url":"https://api.github.com/users/spring-cloud/following{/other_user}","gists_url":"https://api.github.com/users/spring-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-cloud/subscriptions","organizations_url":"https://api.github.com/users/spring-cloud/orgs","repos_url":"https://api.github.com/users/spring-cloud/repos","events_url":"https://api.github.com/users/spring-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/spring-cloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spring-cloud/spring-cloud-stream","description":"Messaging Microservices with Spring Integration","fork":false,"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream","forks_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/forks","keys_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/teams","hooks_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/hooks","issue_events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/events{/number}","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/events","assignees_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/assignees{/user}","branches_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/branches{/branch}","tags_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/tags","blobs_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/languages","stargazers_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/stargazers","contributors_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/contributors","subscribers_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/subscribers","subscription_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/subscription","commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/comments{/number}","contents_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/contents/{+path}","compare_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/merges","archive_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/downloads","issues_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues{/number}","pulls_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/labels{/name}","releases_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/releases{/id}","created_at":"2015-07-08T15:51:38Z","updated_at":"2015-08-27T17:43:34Z","pushed_at":"2015-08-30T17:05:16Z","git_url":"git://github.com/spring-cloud/spring-cloud-stream.git","ssh_url":"git@github.com:spring-cloud/spring-cloud-stream.git","clone_url":"https://github.com/spring-cloud/spring-cloud-stream.git","svn_url":"https://github.com/spring-cloud/spring-cloud-stream","homepage":"http://cloud.spring.io/spring-cloud-stream/","size":2814,"stargazers_count":9,"watchers_count":9,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":9,"forks":16,"open_issues":9,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113"},"html":{"href":"https://github.com/spring-cloud/spring-cloud-stream/pull/113"},"issue":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/113"},"comments":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/issues/113/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/pulls/113/commits"},"statuses":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream/statuses/cd8270c4645973f8cddd9b21f64bc2f01109830d"}}}}