{"action":"created","comment":{"url":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/comments/77266438","id":77266438,"diff_hunk":"@@ -0,0 +1,226 @@\n+/*\n+ * Copyright 2016 the original author or authors.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.springframework.amqp.rabbit.listener;\n+\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.List;\n+import java.util.concurrent.atomic.AtomicBoolean;\n+\n+import org.apache.commons.logging.Log;\n+\n+import org.springframework.amqp.AmqpRejectAndDontRequeueException;\n+import org.springframework.amqp.core.Message;\n+import org.springframework.amqp.core.MessageProperties;\n+import org.springframework.amqp.rabbit.connection.Connection;\n+import org.springframework.amqp.rabbit.connection.ConnectionFactory;\n+import org.springframework.amqp.rabbit.connection.RabbitUtils;\n+import org.springframework.amqp.rabbit.support.DefaultMessagePropertiesConverter;\n+import org.springframework.amqp.rabbit.support.MessagePropertiesConverter;\n+import org.springframework.core.task.SimpleAsyncTaskExecutor;\n+import org.springframework.core.task.TaskExecutor;\n+import org.springframework.util.Assert;\n+\n+import com.rabbitmq.client.AMQP.BasicProperties;\n+import com.rabbitmq.client.Channel;\n+import com.rabbitmq.client.DefaultConsumer;\n+import com.rabbitmq.client.Envelope;\n+\n+/**\n+ * The {@code SimpleMessageListenerContainer} is not so simple. Recent changes to the\n+ * rabbitmq java client has facilitated a much simpler listener container that invokes the\n+ * listener directly on the rabbit client consumer thread. There is no txSize property -\n+ * each message is acked (or nacked) individually.\n+ * @author Gary Russell\n+ * @since 2.0\n+ *\n+ */\n+public class DirectMessageListenerContainer extends AbstractMessageListenerContainer {\n+\n+\tprivate final List<SimpleConsumer> consumers = new ArrayList<SimpleConsumer>();\n+\n+\tprivate final MessagePropertiesConverter messagePropertiesConverter = new DefaultMessagePropertiesConverter();\n+\n+\tprivate volatile TaskExecutor taskExecutor;\n+\n+\tprivate volatile int consumersPerQueue = 1;\n+\n+\tprivate volatile int prefetch = 1;\n+\n+\tprivate volatile boolean defaultRequeueRejected = false;\n+\n+\tprivate volatile long recoveryInterval;\n+\n+\t/**\n+\t * Create an instance with the provided connection factory.\n+\t * @param connectionFactory the connection factory.\n+\t */\n+\tpublic DirectMessageListenerContainer(ConnectionFactory connectionFactory) {\n+\t\tsetConnectionFactory(connectionFactory);\n+\t}\n+\n+\t@Override\n+\tpublic final void setConnectionFactory(ConnectionFactory connectionFactory) {","path":"spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/DirectMessageListenerContainer.java","position":78,"original_position":78,"commit_id":"53c04b26b5fe61df9275db7592ed14d4875f9221","original_commit_id":"53c04b26b5fe61df9275db7592ed14d4875f9221","user":{"login":"garyrussell","id":483832,"avatar_url":"https://avatars.githubusercontent.com/u/483832?v=3","gravatar_id":"","url":"https://api.github.com/users/garyrussell","html_url":"https://github.com/garyrussell","followers_url":"https://api.github.com/users/garyrussell/followers","following_url":"https://api.github.com/users/garyrussell/following{/other_user}","gists_url":"https://api.github.com/users/garyrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/garyrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyrussell/subscriptions","organizations_url":"https://api.github.com/users/garyrussell/orgs","repos_url":"https://api.github.com/users/garyrussell/repos","events_url":"https://api.github.com/users/garyrussell/events{/privacy}","received_events_url":"https://api.github.com/users/garyrussell/received_events","type":"User","site_admin":false},"body":"I have no idea where that came from 😄 ","created_at":"2016-09-01T22:36:12Z","updated_at":"2016-09-01T22:36:12Z","html_url":"https://github.com/spring-projects/spring-amqp/pull/446#discussion_r77266438","pull_request_url":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446","_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/comments/77266438"},"html":{"href":"https://github.com/spring-projects/spring-amqp/pull/446#discussion_r77266438"},"pull_request":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446"}}},"pull_request":{"url":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446","id":83476701,"html_url":"https://github.com/spring-projects/spring-amqp/pull/446","diff_url":"https://github.com/spring-projects/spring-amqp/pull/446.diff","patch_url":"https://github.com/spring-projects/spring-amqp/pull/446.patch","issue_url":"https://api.github.com/repos/spring-projects/spring-amqp/issues/446","number":446,"state":"open","locked":false,"title":"AMQP-634: DirectMessageListenerContainer","user":{"login":"garyrussell","id":483832,"avatar_url":"https://avatars.githubusercontent.com/u/483832?v=3","gravatar_id":"","url":"https://api.github.com/users/garyrussell","html_url":"https://github.com/garyrussell","followers_url":"https://api.github.com/users/garyrussell/followers","following_url":"https://api.github.com/users/garyrussell/following{/other_user}","gists_url":"https://api.github.com/users/garyrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/garyrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyrussell/subscriptions","organizations_url":"https://api.github.com/users/garyrussell/orgs","repos_url":"https://api.github.com/users/garyrussell/repos","events_url":"https://api.github.com/users/garyrussell/events{/privacy}","received_events_url":"https://api.github.com/users/garyrussell/received_events","type":"User","site_admin":false},"body":"JIRA: https://jira.spring.io/browse/AMQP-634\r\n\r\nInitial commit for `DirectMessageListenerContainer` that runs the listener on\r\nthe rabbitmq client thread.\r\n\r\nReplaces #380 ","created_at":"2016-08-31T15:36:54Z","updated_at":"2016-09-01T22:36:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e04c28ff9f0081ec666f14a5930f6ad6b24b4e15","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446/commits","review_comments_url":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446/comments","review_comment_url":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spring-projects/spring-amqp/issues/446/comments","statuses_url":"https://api.github.com/repos/spring-projects/spring-amqp/statuses/53c04b26b5fe61df9275db7592ed14d4875f9221","head":{"label":"garyrussell:AMQP-634","ref":"AMQP-634","sha":"53c04b26b5fe61df9275db7592ed14d4875f9221","user":{"login":"garyrussell","id":483832,"avatar_url":"https://avatars.githubusercontent.com/u/483832?v=3","gravatar_id":"","url":"https://api.github.com/users/garyrussell","html_url":"https://github.com/garyrussell","followers_url":"https://api.github.com/users/garyrussell/followers","following_url":"https://api.github.com/users/garyrussell/following{/other_user}","gists_url":"https://api.github.com/users/garyrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/garyrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyrussell/subscriptions","organizations_url":"https://api.github.com/users/garyrussell/orgs","repos_url":"https://api.github.com/users/garyrussell/repos","events_url":"https://api.github.com/users/garyrussell/events{/privacy}","received_events_url":"https://api.github.com/users/garyrussell/received_events","type":"User","site_admin":false},"repo":{"id":3138424,"name":"spring-amqp","full_name":"garyrussell/spring-amqp","owner":{"login":"garyrussell","id":483832,"avatar_url":"https://avatars.githubusercontent.com/u/483832?v=3","gravatar_id":"","url":"https://api.github.com/users/garyrussell","html_url":"https://github.com/garyrussell","followers_url":"https://api.github.com/users/garyrussell/followers","following_url":"https://api.github.com/users/garyrussell/following{/other_user}","gists_url":"https://api.github.com/users/garyrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/garyrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyrussell/subscriptions","organizations_url":"https://api.github.com/users/garyrussell/orgs","repos_url":"https://api.github.com/users/garyrussell/repos","events_url":"https://api.github.com/users/garyrussell/events{/privacy}","received_events_url":"https://api.github.com/users/garyrussell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/garyrussell/spring-amqp","description":"Spring AMQP - support for Spring programming model with AMQP, especially but not limited to RabbitMQ","fork":true,"url":"https://api.github.com/repos/garyrussell/spring-amqp","forks_url":"https://api.github.com/repos/garyrussell/spring-amqp/forks","keys_url":"https://api.github.com/repos/garyrussell/spring-amqp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garyrussell/spring-amqp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garyrussell/spring-amqp/teams","hooks_url":"https://api.github.com/repos/garyrussell/spring-amqp/hooks","issue_events_url":"https://api.github.com/repos/garyrussell/spring-amqp/issues/events{/number}","events_url":"https://api.github.com/repos/garyrussell/spring-amqp/events","assignees_url":"https://api.github.com/repos/garyrussell/spring-amqp/assignees{/user}","branches_url":"https://api.github.com/repos/garyrussell/spring-amqp/branches{/branch}","tags_url":"https://api.github.com/repos/garyrussell/spring-amqp/tags","blobs_url":"https://api.github.com/repos/garyrussell/spring-amqp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garyrussell/spring-amqp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garyrussell/spring-amqp/git/refs{/sha}","trees_url":"https://api.github.com/repos/garyrussell/spring-amqp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garyrussell/spring-amqp/statuses/{sha}","languages_url":"https://api.github.com/repos/garyrussell/spring-amqp/languages","stargazers_url":"https://api.github.com/repos/garyrussell/spring-amqp/stargazers","contributors_url":"https://api.github.com/repos/garyrussell/spring-amqp/contributors","subscribers_url":"https://api.github.com/repos/garyrussell/spring-amqp/subscribers","subscription_url":"https://api.github.com/repos/garyrussell/spring-amqp/subscription","commits_url":"https://api.github.com/repos/garyrussell/spring-amqp/commits{/sha}","git_commits_url":"https://api.github.com/repos/garyrussell/spring-amqp/git/commits{/sha}","comments_url":"https://api.github.com/repos/garyrussell/spring-amqp/comments{/number}","issue_comment_url":"https://api.github.com/repos/garyrussell/spring-amqp/issues/comments{/number}","contents_url":"https://api.github.com/repos/garyrussell/spring-amqp/contents/{+path}","compare_url":"https://api.github.com/repos/garyrussell/spring-amqp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garyrussell/spring-amqp/merges","archive_url":"https://api.github.com/repos/garyrussell/spring-amqp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garyrussell/spring-amqp/downloads","issues_url":"https://api.github.com/repos/garyrussell/spring-amqp/issues{/number}","pulls_url":"https://api.github.com/repos/garyrussell/spring-amqp/pulls{/number}","milestones_url":"https://api.github.com/repos/garyrussell/spring-amqp/milestones{/number}","notifications_url":"https://api.github.com/repos/garyrussell/spring-amqp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garyrussell/spring-amqp/labels{/name}","releases_url":"https://api.github.com/repos/garyrussell/spring-amqp/releases{/id}","deployments_url":"https://api.github.com/repos/garyrussell/spring-amqp/deployments","created_at":"2012-01-09T17:21:18Z","updated_at":"2015-10-21T18:02:46Z","pushed_at":"2016-09-01T19:16:11Z","git_url":"git://github.com/garyrussell/spring-amqp.git","ssh_url":"git@github.com:garyrussell/spring-amqp.git","clone_url":"https://github.com/garyrussell/spring-amqp.git","svn_url":"https://github.com/garyrussell/spring-amqp","homepage":"http://www.springsource.org/spring-amqp","size":7782,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":4,"default_branch":"master"}},"base":{"label":"spring-projects:master","ref":"master","sha":"8cc1caf1128fa0d828457ed140ad693ec3ab65a7","user":{"login":"spring-projects","id":317776,"avatar_url":"https://avatars.githubusercontent.com/u/317776?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"repo":{"id":1088796,"name":"spring-amqp","full_name":"spring-projects/spring-amqp","owner":{"login":"spring-projects","id":317776,"avatar_url":"https://avatars.githubusercontent.com/u/317776?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spring-projects/spring-amqp","description":"Spring AMQP - support for Spring programming model with AMQP, especially but not limited to RabbitMQ","fork":false,"url":"https://api.github.com/repos/spring-projects/spring-amqp","forks_url":"https://api.github.com/repos/spring-projects/spring-amqp/forks","keys_url":"https://api.github.com/repos/spring-projects/spring-amqp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-projects/spring-amqp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-projects/spring-amqp/teams","hooks_url":"https://api.github.com/repos/spring-projects/spring-amqp/hooks","issue_events_url":"https://api.github.com/repos/spring-projects/spring-amqp/issues/events{/number}","events_url":"https://api.github.com/repos/spring-projects/spring-amqp/events","assignees_url":"https://api.github.com/repos/spring-projects/spring-amqp/assignees{/user}","branches_url":"https://api.github.com/repos/spring-projects/spring-amqp/branches{/branch}","tags_url":"https://api.github.com/repos/spring-projects/spring-amqp/tags","blobs_url":"https://api.github.com/repos/spring-projects/spring-amqp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-projects/spring-amqp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-projects/spring-amqp/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-projects/spring-amqp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-projects/spring-amqp/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-projects/spring-amqp/languages","stargazers_url":"https://api.github.com/repos/spring-projects/spring-amqp/stargazers","contributors_url":"https://api.github.com/repos/spring-projects/spring-amqp/contributors","subscribers_url":"https://api.github.com/repos/spring-projects/spring-amqp/subscribers","subscription_url":"https://api.github.com/repos/spring-projects/spring-amqp/subscription","commits_url":"https://api.github.com/repos/spring-projects/spring-amqp/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-projects/spring-amqp/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-projects/spring-amqp/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-projects/spring-amqp/issues/comments{/number}","contents_url":"https://api.github.com/repos/spring-projects/spring-amqp/contents/{+path}","compare_url":"https://api.github.com/repos/spring-projects/spring-amqp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-projects/spring-amqp/merges","archive_url":"https://api.github.com/repos/spring-projects/spring-amqp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-projects/spring-amqp/downloads","issues_url":"https://api.github.com/repos/spring-projects/spring-amqp/issues{/number}","pulls_url":"https://api.github.com/repos/spring-projects/spring-amqp/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-projects/spring-amqp/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-projects/spring-amqp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-projects/spring-amqp/labels{/name}","releases_url":"https://api.github.com/repos/spring-projects/spring-amqp/releases{/id}","deployments_url":"https://api.github.com/repos/spring-projects/spring-amqp/deployments","created_at":"2010-11-17T15:50:16Z","updated_at":"2016-09-01T12:40:38Z","pushed_at":"2016-09-01T21:01:13Z","git_url":"git://github.com/spring-projects/spring-amqp.git","ssh_url":"git@github.com:spring-projects/spring-amqp.git","clone_url":"https://github.com/spring-projects/spring-amqp.git","svn_url":"https://github.com/spring-projects/spring-amqp","homepage":"http://www.springsource.org/spring-amqp","size":8798,"stargazers_count":249,"watchers_count":249,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":219,"mirror_url":null,"open_issues_count":2,"forks":219,"open_issues":2,"watchers":249,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446"},"html":{"href":"https://github.com/spring-projects/spring-amqp/pull/446"},"issue":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/issues/446"},"comments":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/issues/446/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/pulls/446/commits"},"statuses":{"href":"https://api.github.com/repos/spring-projects/spring-amqp/statuses/53c04b26b5fe61df9275db7592ed14d4875f9221"}}}}
{"actor":{"display_login":"garyrussell"}}