{"action":"created","comment":{"url":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/comments/65462327","id":65462327,"diff_hunk":"@@ -241,24 +272,32 @@ public void setupListenerContainer(MessageListenerContainer listenerContainer, M\n \tprotected abstract MessageListener<K, V> createMessageListener(MessageListenerContainer container,\n \t\t\tMessageConverter messageConverter);\n \n+\t@SuppressWarnings(\"unchecked\")\n \tprivate void setupMessageListener(MessageListenerContainer container, MessageConverter messageConverter) {\n-\t\tMessageListener<K, V> messageListener = createMessageListener(container, messageConverter);\n+\t\tObject messageListener = createMessageListener(container, messageConverter);\n \t\tAssert.state(messageListener != null, \"Endpoint [\" + this + \"] must provide a non null message listener\");\n-\t\tif (this.recordFilterStrategy != null) {\n+\t\tif (this.retryTemplate != null) {\n \t\t\tif (messageListener instanceof AcknowledgingMessageListener) {\n-\t\t\t\t@SuppressWarnings(\"unchecked\")\n-\t\t\t\tAcknowledgingMessageListener<K, V> aml = (AcknowledgingMessageListener<K, V>) messageListener;\n-\t\t\t\taml = new FilteringAcknowledgingMessageListenerAdapter<>(this.recordFilterStrategy, aml, this.ackDiscarded);\n-\t\t\t\tcontainer.setupMessageListener(aml);\n+\t\t\t\tmessageListener = new RetryingAcknowledgingMessageListenerAdapter<>(\n+\t\t\t\t\t\t(AcknowledgingMessageListener<K, V>) messageListener, this.retryTemplate,\n+\t\t\t\t\t\tthis.recoveryCallback);\n \t\t\t}\n \t\t\telse {\n-\t\t\t\tmessageListener = new FilteringMessageListenerAdapter<>(this.recordFilterStrategy, messageListener);\n-\t\t\t\tcontainer.setupMessageListener(messageListener);\n+\t\t\t\tmessageListener = new FilteringMessageListenerAdapter<>(this.recordFilterStrategy,\n+\t\t\t\t\t\t(MessageListener<K, V>) messageListener);\n \t\t\t}\n \t\t}\n-\t\telse {\n-\t\t\tcontainer.setupMessageListener(messageListener);\n+\t\tif (this.recordFilterStrategy != null) {\n+\t\t\tif (messageListener instanceof AcknowledgingMessageListener) {\n+\t\t\t\tmessageListener = new FilteringAcknowledgingMessageListenerAdapter<>(this.recordFilterStrategy,\n+\t\t\t\t\t\t(AcknowledgingMessageListener<K, V>) messageListener, this.ackDiscarded);","path":"spring-kafka/src/main/java/org/springframework/kafka/config/AbstractKafkaListenerEndpoint.java","position":95,"original_position":95,"commit_id":"4e2f32dc7213d89960857e733a6c982cd43c8202","original_commit_id":"4e2f32dc7213d89960857e733a6c982cd43c8202","user":{"login":"artembilan","id":1071590,"avatar_url":"https://avatars.githubusercontent.com/u/1071590?v=3","gravatar_id":"","url":"https://api.github.com/users/artembilan","html_url":"https://github.com/artembilan","followers_url":"https://api.github.com/users/artembilan/followers","following_url":"https://api.github.com/users/artembilan/following{/other_user}","gists_url":"https://api.github.com/users/artembilan/gists{/gist_id}","starred_url":"https://api.github.com/users/artembilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artembilan/subscriptions","organizations_url":"https://api.github.com/users/artembilan/orgs","repos_url":"https://api.github.com/users/artembilan/repos","events_url":"https://api.github.com/users/artembilan/events{/privacy}","received_events_url":"https://api.github.com/users/artembilan/received_events","type":"User","site_admin":false},"body":"Can't we revise API and really have `messageListener` as a first ctor arg?\r\nJust for cleaner code :smile: ","created_at":"2016-06-01T23:39:40Z","updated_at":"2016-06-01T23:39:40Z","html_url":"https://github.com/spring-projects/spring-kafka/pull/106#discussion_r65462327","pull_request_url":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106","_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/comments/65462327"},"html":{"href":"https://github.com/spring-projects/spring-kafka/pull/106#discussion_r65462327"},"pull_request":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106"}}},"pull_request":{"url":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106","id":72252411,"html_url":"https://github.com/spring-projects/spring-kafka/pull/106","diff_url":"https://github.com/spring-projects/spring-kafka/pull/106.diff","patch_url":"https://github.com/spring-projects/spring-kafka/pull/106.patch","issue_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/106","number":106,"state":"open","locked":false,"title":"GH-105: Externalize Retry","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":"Resolves #105\r\n    \r\nExtract the retry template into adapters.\r\n","created_at":"2016-06-01T21:07:32Z","updated_at":"2016-06-01T23:39:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"452f7a1df8e34e20da1ec88ae4e6a6bdff403f29","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106/commits","review_comments_url":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106/comments","review_comment_url":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/106/comments","statuses_url":"https://api.github.com/repos/spring-projects/spring-kafka/statuses/4e2f32dc7213d89960857e733a6c982cd43c8202","head":{"label":"garyrussell:GH-105","ref":"GH-105","sha":"4e2f32dc7213d89960857e733a6c982cd43c8202","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":53343563,"name":"spring-kafka","full_name":"garyrussell/spring-kafka","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-kafka","description":"","fork":true,"url":"https://api.github.com/repos/garyrussell/spring-kafka","forks_url":"https://api.github.com/repos/garyrussell/spring-kafka/forks","keys_url":"https://api.github.com/repos/garyrussell/spring-kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garyrussell/spring-kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garyrussell/spring-kafka/teams","hooks_url":"https://api.github.com/repos/garyrussell/spring-kafka/hooks","issue_events_url":"https://api.github.com/repos/garyrussell/spring-kafka/issues/events{/number}","events_url":"https://api.github.com/repos/garyrussell/spring-kafka/events","assignees_url":"https://api.github.com/repos/garyrussell/spring-kafka/assignees{/user}","branches_url":"https://api.github.com/repos/garyrussell/spring-kafka/branches{/branch}","tags_url":"https://api.github.com/repos/garyrussell/spring-kafka/tags","blobs_url":"https://api.github.com/repos/garyrussell/spring-kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garyrussell/spring-kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garyrussell/spring-kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/garyrussell/spring-kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garyrussell/spring-kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/garyrussell/spring-kafka/languages","stargazers_url":"https://api.github.com/repos/garyrussell/spring-kafka/stargazers","contributors_url":"https://api.github.com/repos/garyrussell/spring-kafka/contributors","subscribers_url":"https://api.github.com/repos/garyrussell/spring-kafka/subscribers","subscription_url":"https://api.github.com/repos/garyrussell/spring-kafka/subscription","commits_url":"https://api.github.com/repos/garyrussell/spring-kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/garyrussell/spring-kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/garyrussell/spring-kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/garyrussell/spring-kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/garyrussell/spring-kafka/contents/{+path}","compare_url":"https://api.github.com/repos/garyrussell/spring-kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garyrussell/spring-kafka/merges","archive_url":"https://api.github.com/repos/garyrussell/spring-kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garyrussell/spring-kafka/downloads","issues_url":"https://api.github.com/repos/garyrussell/spring-kafka/issues{/number}","pulls_url":"https://api.github.com/repos/garyrussell/spring-kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/garyrussell/spring-kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/garyrussell/spring-kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garyrussell/spring-kafka/labels{/name}","releases_url":"https://api.github.com/repos/garyrussell/spring-kafka/releases{/id}","deployments_url":"https://api.github.com/repos/garyrussell/spring-kafka/deployments","created_at":"2016-03-07T17:10:01Z","updated_at":"2016-03-07T17:10:02Z","pushed_at":"2016-06-01T21:10:47Z","git_url":"git://github.com/garyrussell/spring-kafka.git","ssh_url":"git@github.com:garyrussell/spring-kafka.git","clone_url":"https://github.com/garyrussell/spring-kafka.git","svn_url":"https://github.com/garyrussell/spring-kafka","homepage":null,"size":644,"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-projects:master","ref":"master","sha":"b1dc76e3a974f09b52c962f90351999eb5880af9","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":52980493,"name":"spring-kafka","full_name":"spring-projects/spring-kafka","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-kafka","description":"Provides Familiar Spring Abstractions for Apache Kafka","fork":false,"url":"https://api.github.com/repos/spring-projects/spring-kafka","forks_url":"https://api.github.com/repos/spring-projects/spring-kafka/forks","keys_url":"https://api.github.com/repos/spring-projects/spring-kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-projects/spring-kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-projects/spring-kafka/teams","hooks_url":"https://api.github.com/repos/spring-projects/spring-kafka/hooks","issue_events_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/events{/number}","events_url":"https://api.github.com/repos/spring-projects/spring-kafka/events","assignees_url":"https://api.github.com/repos/spring-projects/spring-kafka/assignees{/user}","branches_url":"https://api.github.com/repos/spring-projects/spring-kafka/branches{/branch}","tags_url":"https://api.github.com/repos/spring-projects/spring-kafka/tags","blobs_url":"https://api.github.com/repos/spring-projects/spring-kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-projects/spring-kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-projects/spring-kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-projects/spring-kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-projects/spring-kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-projects/spring-kafka/languages","stargazers_url":"https://api.github.com/repos/spring-projects/spring-kafka/stargazers","contributors_url":"https://api.github.com/repos/spring-projects/spring-kafka/contributors","subscribers_url":"https://api.github.com/repos/spring-projects/spring-kafka/subscribers","subscription_url":"https://api.github.com/repos/spring-projects/spring-kafka/subscription","commits_url":"https://api.github.com/repos/spring-projects/spring-kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-projects/spring-kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-projects/spring-kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/spring-projects/spring-kafka/contents/{+path}","compare_url":"https://api.github.com/repos/spring-projects/spring-kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-projects/spring-kafka/merges","archive_url":"https://api.github.com/repos/spring-projects/spring-kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-projects/spring-kafka/downloads","issues_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues{/number}","pulls_url":"https://api.github.com/repos/spring-projects/spring-kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-projects/spring-kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-projects/spring-kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-projects/spring-kafka/labels{/name}","releases_url":"https://api.github.com/repos/spring-projects/spring-kafka/releases{/id}","deployments_url":"https://api.github.com/repos/spring-projects/spring-kafka/deployments","created_at":"2016-03-02T17:01:33Z","updated_at":"2016-06-01T16:20:29Z","pushed_at":"2016-06-01T21:10:48Z","git_url":"git://github.com/spring-projects/spring-kafka.git","ssh_url":"git@github.com:spring-projects/spring-kafka.git","clone_url":"https://github.com/spring-projects/spring-kafka.git","svn_url":"https://github.com/spring-projects/spring-kafka","homepage":"https://projects.spring.io/spring-kafka","size":1398,"stargazers_count":46,"watchers_count":46,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":27,"mirror_url":null,"open_issues_count":8,"forks":27,"open_issues":8,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106"},"html":{"href":"https://github.com/spring-projects/spring-kafka/pull/106"},"issue":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/issues/106"},"comments":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/issues/106/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/pulls/106/commits"},"statuses":{"href":"https://api.github.com/repos/spring-projects/spring-kafka/statuses/4e2f32dc7213d89960857e733a6c982cd43c8202"}}}}
{"actor":{"display_login":"artembilan"}}