{"action":"created","comment":{"url":"https://api.github.com/repos/esbtools/event-handler/pulls/comments/53053650","id":53053650,"diff_hunk":"@@ -0,0 +1,124 @@\n+/*\n+ *  Copyright 2016 esbtools Contributors and/or its affiliates.\n+ *\n+ *  This file is part of esbtools.\n+ *\n+ *  This program is free software: you can redistribute it and/or modify\n+ *  it under the terms of the GNU General Public License as published by\n+ *  the Free Software Foundation, either version 3 of the License, or\n+ *  (at your option) any later version.\n+ *  This program is distributed in the hope that it will be useful,\n+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ *  GNU General Public License for more details.\n+ *\n+ *  You should have received a copy of the GNU General Public License\n+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+package org.esbtools.eventhandler;\n+\n+import org.apache.camel.builder.RouteBuilder;\n+\n+import java.time.Duration;\n+import java.util.ArrayList;\n+import java.util.Collection;\n+import java.util.List;\n+import java.util.Objects;\n+import java.util.concurrent.ExecutionException;\n+import java.util.concurrent.Future;\n+import java.util.concurrent.TimeUnit;\n+import java.util.concurrent.TimeoutException;\n+import java.util.concurrent.atomic.AtomicInteger;\n+\n+public class AsyncMessageProcessorRoute extends RouteBuilder {\n+    private final String fromUri;\n+    private final String failureUri;\n+    private final Duration processTimeout;\n+    private final MessageFactory messageFactory;\n+\n+    private final int idCount = idCounter.getAndIncrement();\n+    private final String routeId = \"async-message-repository-\" + idCount;","path":"lib/src/main/java/org/esbtools/eventhandler/AsyncMessageProcessorRoute.java","position":41,"original_position":41,"commit_id":"48844966c7a2ef0b82895ef73e4da38b53a1a8cb","original_commit_id":"48844966c7a2ef0b82895ef73e4da38b53a1a8cb","user":{"login":"alechenninger","id":3496559,"avatar_url":"https://avatars.githubusercontent.com/u/3496559?v=3","gravatar_id":"","url":"https://api.github.com/users/alechenninger","html_url":"https://github.com/alechenninger","followers_url":"https://api.github.com/users/alechenninger/followers","following_url":"https://api.github.com/users/alechenninger/following{/other_user}","gists_url":"https://api.github.com/users/alechenninger/gists{/gist_id}","starred_url":"https://api.github.com/users/alechenninger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alechenninger/subscriptions","organizations_url":"https://api.github.com/users/alechenninger/orgs","repos_url":"https://api.github.com/users/alechenninger/repos","events_url":"https://api.github.com/users/alechenninger/events{/privacy}","received_events_url":"https://api.github.com/users/alechenninger/received_events","type":"User","site_admin":false},"body":"Numeric portion is just so multiple can be instantiated in the same camel context, which is mildly useful if only for testing purposes. `fromUri` is typically broadcast in many camel log messages so I think it may be redundant to include in routeId / maybe somewhat atypical from what I've seen.","created_at":"2016-02-16T18:22:37Z","updated_at":"2016-02-16T18:22:37Z","html_url":"https://github.com/esbtools/event-handler/pull/21#discussion_r53053650","pull_request_url":"https://api.github.com/repos/esbtools/event-handler/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/esbtools/event-handler/pulls/comments/53053650"},"html":{"href":"https://github.com/esbtools/event-handler/pull/21#discussion_r53053650"},"pull_request":{"href":"https://api.github.com/repos/esbtools/event-handler/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/esbtools/event-handler/pulls/21","id":59418506,"html_url":"https://github.com/esbtools/event-handler/pull/21","diff_url":"https://github.com/esbtools/event-handler/pull/21.diff","patch_url":"https://github.com/esbtools/event-handler/pull/21.patch","issue_url":"https://api.github.com/repos/esbtools/event-handler/issues/21","number":21,"state":"open","locked":false,"title":"AsyncMessageProcessorRoute","user":{"login":"alechenninger","id":3496559,"avatar_url":"https://avatars.githubusercontent.com/u/3496559?v=3","gravatar_id":"","url":"https://api.github.com/users/alechenninger","html_url":"https://github.com/alechenninger","followers_url":"https://api.github.com/users/alechenninger/followers","following_url":"https://api.github.com/users/alechenninger/following{/other_user}","gists_url":"https://api.github.com/users/alechenninger/gists{/gist_id}","starred_url":"https://api.github.com/users/alechenninger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alechenninger/subscriptions","organizations_url":"https://api.github.com/users/alechenninger/orgs","repos_url":"https://api.github.com/users/alechenninger/repos","events_url":"https://api.github.com/users/alechenninger/events{/privacy}","received_events_url":"https://api.github.com/users/alechenninger/received_events","type":"User","site_admin":false},"body":"This can be used to asynchronously process messages which have business logic completely independent of each other.\r\n\r\nFor example, incoming document messages can be parsed and as part of processing, update (or insert) entities in a data store (such as lightblue). The handling of any incoming document doesn't need to know about any other. Perhaps you could argue that it could benefit from this, such as if two documents referred to the same entity, then they could coordinate and do one update instead of two, but this is something we should talk about later.\r\n\r\nIt could also be used to handle incoming messages were are more like \"requests\" or \"command messages\" which as a result of processing do something else.\r\n\r\nIt's generic enough that I think eventually maybe our other types of events could be brought together under this kind of model but, for now those differ in that, in least for document events, processing involves coordinating many document events together and optimizing them, so it is not natural to implement with this additional abstraction just yet.\r\n\r\nOn the other hand, Notifications as currently implemented could be handled in this model actually. But this is for another conversation, and another PR :).","created_at":"2016-02-15T22:02:16Z","updated_at":"2016-02-16T18:22:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b18567fbe7370c12a3baae9cba2c66257988bc7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/esbtools/event-handler/pulls/21/commits","review_comments_url":"https://api.github.com/repos/esbtools/event-handler/pulls/21/comments","review_comment_url":"https://api.github.com/repos/esbtools/event-handler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/esbtools/event-handler/issues/21/comments","statuses_url":"https://api.github.com/repos/esbtools/event-handler/statuses/48844966c7a2ef0b82895ef73e4da38b53a1a8cb","head":{"label":"esbtools:message-processor","ref":"message-processor","sha":"48844966c7a2ef0b82895ef73e4da38b53a1a8cb","user":{"login":"esbtools","id":10727765,"avatar_url":"https://avatars.githubusercontent.com/u/10727765?v=3","gravatar_id":"","url":"https://api.github.com/users/esbtools","html_url":"https://github.com/esbtools","followers_url":"https://api.github.com/users/esbtools/followers","following_url":"https://api.github.com/users/esbtools/following{/other_user}","gists_url":"https://api.github.com/users/esbtools/gists{/gist_id}","starred_url":"https://api.github.com/users/esbtools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbtools/subscriptions","organizations_url":"https://api.github.com/users/esbtools/orgs","repos_url":"https://api.github.com/users/esbtools/repos","events_url":"https://api.github.com/users/esbtools/events{/privacy}","received_events_url":"https://api.github.com/users/esbtools/received_events","type":"Organization","site_admin":false},"repo":{"id":48069141,"name":"event-handler","full_name":"esbtools/event-handler","owner":{"login":"esbtools","id":10727765,"avatar_url":"https://avatars.githubusercontent.com/u/10727765?v=3","gravatar_id":"","url":"https://api.github.com/users/esbtools","html_url":"https://github.com/esbtools","followers_url":"https://api.github.com/users/esbtools/followers","following_url":"https://api.github.com/users/esbtools/following{/other_user}","gists_url":"https://api.github.com/users/esbtools/gists{/gist_id}","starred_url":"https://api.github.com/users/esbtools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbtools/subscriptions","organizations_url":"https://api.github.com/users/esbtools/orgs","repos_url":"https://api.github.com/users/esbtools/repos","events_url":"https://api.github.com/users/esbtools/events{/privacy}","received_events_url":"https://api.github.com/users/esbtools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/esbtools/event-handler","description":"Notification in, document out.","fork":false,"url":"https://api.github.com/repos/esbtools/event-handler","forks_url":"https://api.github.com/repos/esbtools/event-handler/forks","keys_url":"https://api.github.com/repos/esbtools/event-handler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/esbtools/event-handler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/esbtools/event-handler/teams","hooks_url":"https://api.github.com/repos/esbtools/event-handler/hooks","issue_events_url":"https://api.github.com/repos/esbtools/event-handler/issues/events{/number}","events_url":"https://api.github.com/repos/esbtools/event-handler/events","assignees_url":"https://api.github.com/repos/esbtools/event-handler/assignees{/user}","branches_url":"https://api.github.com/repos/esbtools/event-handler/branches{/branch}","tags_url":"https://api.github.com/repos/esbtools/event-handler/tags","blobs_url":"https://api.github.com/repos/esbtools/event-handler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/esbtools/event-handler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/esbtools/event-handler/git/refs{/sha}","trees_url":"https://api.github.com/repos/esbtools/event-handler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/esbtools/event-handler/statuses/{sha}","languages_url":"https://api.github.com/repos/esbtools/event-handler/languages","stargazers_url":"https://api.github.com/repos/esbtools/event-handler/stargazers","contributors_url":"https://api.github.com/repos/esbtools/event-handler/contributors","subscribers_url":"https://api.github.com/repos/esbtools/event-handler/subscribers","subscription_url":"https://api.github.com/repos/esbtools/event-handler/subscription","commits_url":"https://api.github.com/repos/esbtools/event-handler/commits{/sha}","git_commits_url":"https://api.github.com/repos/esbtools/event-handler/git/commits{/sha}","comments_url":"https://api.github.com/repos/esbtools/event-handler/comments{/number}","issue_comment_url":"https://api.github.com/repos/esbtools/event-handler/issues/comments{/number}","contents_url":"https://api.github.com/repos/esbtools/event-handler/contents/{+path}","compare_url":"https://api.github.com/repos/esbtools/event-handler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/esbtools/event-handler/merges","archive_url":"https://api.github.com/repos/esbtools/event-handler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/esbtools/event-handler/downloads","issues_url":"https://api.github.com/repos/esbtools/event-handler/issues{/number}","pulls_url":"https://api.github.com/repos/esbtools/event-handler/pulls{/number}","milestones_url":"https://api.github.com/repos/esbtools/event-handler/milestones{/number}","notifications_url":"https://api.github.com/repos/esbtools/event-handler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/esbtools/event-handler/labels{/name}","releases_url":"https://api.github.com/repos/esbtools/event-handler/releases{/id}","deployments_url":"https://api.github.com/repos/esbtools/event-handler/deployments","created_at":"2015-12-15T21:08:53Z","updated_at":"2016-01-21T16:44:01Z","pushed_at":"2016-02-15T22:02:16Z","git_url":"git://github.com/esbtools/event-handler.git","ssh_url":"git@github.com:esbtools/event-handler.git","clone_url":"https://github.com/esbtools/event-handler.git","svn_url":"https://github.com/esbtools/event-handler","homepage":"","size":402,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":1,"default_branch":"master"}},"base":{"label":"esbtools:master","ref":"master","sha":"6bd5ac4dc64a9397124a617c262946982c7ad737","user":{"login":"esbtools","id":10727765,"avatar_url":"https://avatars.githubusercontent.com/u/10727765?v=3","gravatar_id":"","url":"https://api.github.com/users/esbtools","html_url":"https://github.com/esbtools","followers_url":"https://api.github.com/users/esbtools/followers","following_url":"https://api.github.com/users/esbtools/following{/other_user}","gists_url":"https://api.github.com/users/esbtools/gists{/gist_id}","starred_url":"https://api.github.com/users/esbtools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbtools/subscriptions","organizations_url":"https://api.github.com/users/esbtools/orgs","repos_url":"https://api.github.com/users/esbtools/repos","events_url":"https://api.github.com/users/esbtools/events{/privacy}","received_events_url":"https://api.github.com/users/esbtools/received_events","type":"Organization","site_admin":false},"repo":{"id":48069141,"name":"event-handler","full_name":"esbtools/event-handler","owner":{"login":"esbtools","id":10727765,"avatar_url":"https://avatars.githubusercontent.com/u/10727765?v=3","gravatar_id":"","url":"https://api.github.com/users/esbtools","html_url":"https://github.com/esbtools","followers_url":"https://api.github.com/users/esbtools/followers","following_url":"https://api.github.com/users/esbtools/following{/other_user}","gists_url":"https://api.github.com/users/esbtools/gists{/gist_id}","starred_url":"https://api.github.com/users/esbtools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbtools/subscriptions","organizations_url":"https://api.github.com/users/esbtools/orgs","repos_url":"https://api.github.com/users/esbtools/repos","events_url":"https://api.github.com/users/esbtools/events{/privacy}","received_events_url":"https://api.github.com/users/esbtools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/esbtools/event-handler","description":"Notification in, document out.","fork":false,"url":"https://api.github.com/repos/esbtools/event-handler","forks_url":"https://api.github.com/repos/esbtools/event-handler/forks","keys_url":"https://api.github.com/repos/esbtools/event-handler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/esbtools/event-handler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/esbtools/event-handler/teams","hooks_url":"https://api.github.com/repos/esbtools/event-handler/hooks","issue_events_url":"https://api.github.com/repos/esbtools/event-handler/issues/events{/number}","events_url":"https://api.github.com/repos/esbtools/event-handler/events","assignees_url":"https://api.github.com/repos/esbtools/event-handler/assignees{/user}","branches_url":"https://api.github.com/repos/esbtools/event-handler/branches{/branch}","tags_url":"https://api.github.com/repos/esbtools/event-handler/tags","blobs_url":"https://api.github.com/repos/esbtools/event-handler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/esbtools/event-handler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/esbtools/event-handler/git/refs{/sha}","trees_url":"https://api.github.com/repos/esbtools/event-handler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/esbtools/event-handler/statuses/{sha}","languages_url":"https://api.github.com/repos/esbtools/event-handler/languages","stargazers_url":"https://api.github.com/repos/esbtools/event-handler/stargazers","contributors_url":"https://api.github.com/repos/esbtools/event-handler/contributors","subscribers_url":"https://api.github.com/repos/esbtools/event-handler/subscribers","subscription_url":"https://api.github.com/repos/esbtools/event-handler/subscription","commits_url":"https://api.github.com/repos/esbtools/event-handler/commits{/sha}","git_commits_url":"https://api.github.com/repos/esbtools/event-handler/git/commits{/sha}","comments_url":"https://api.github.com/repos/esbtools/event-handler/comments{/number}","issue_comment_url":"https://api.github.com/repos/esbtools/event-handler/issues/comments{/number}","contents_url":"https://api.github.com/repos/esbtools/event-handler/contents/{+path}","compare_url":"https://api.github.com/repos/esbtools/event-handler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/esbtools/event-handler/merges","archive_url":"https://api.github.com/repos/esbtools/event-handler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/esbtools/event-handler/downloads","issues_url":"https://api.github.com/repos/esbtools/event-handler/issues{/number}","pulls_url":"https://api.github.com/repos/esbtools/event-handler/pulls{/number}","milestones_url":"https://api.github.com/repos/esbtools/event-handler/milestones{/number}","notifications_url":"https://api.github.com/repos/esbtools/event-handler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/esbtools/event-handler/labels{/name}","releases_url":"https://api.github.com/repos/esbtools/event-handler/releases{/id}","deployments_url":"https://api.github.com/repos/esbtools/event-handler/deployments","created_at":"2015-12-15T21:08:53Z","updated_at":"2016-01-21T16:44:01Z","pushed_at":"2016-02-15T22:02:16Z","git_url":"git://github.com/esbtools/event-handler.git","ssh_url":"git@github.com:esbtools/event-handler.git","clone_url":"https://github.com/esbtools/event-handler.git","svn_url":"https://github.com/esbtools/event-handler","homepage":"","size":402,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/esbtools/event-handler/pulls/21"},"html":{"href":"https://github.com/esbtools/event-handler/pull/21"},"issue":{"href":"https://api.github.com/repos/esbtools/event-handler/issues/21"},"comments":{"href":"https://api.github.com/repos/esbtools/event-handler/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/esbtools/event-handler/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/esbtools/event-handler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/esbtools/event-handler/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/esbtools/event-handler/statuses/48844966c7a2ef0b82895ef73e4da38b53a1a8cb"}}}}