{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/117","repository_url":"https://api.github.com/repos/spring-projects/spring-kafka","labels_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/117/comments","events_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/117/events","html_url":"https://github.com/spring-projects/spring-kafka/issues/117","id":159420605,"number":117,"title":"double acks when using acknowledgingMessageListener","user":{"login":"dmachlin","id":19839423,"avatar_url":"https://avatars.githubusercontent.com/u/19839423?v=3","gravatar_id":"","url":"https://api.github.com/users/dmachlin","html_url":"https://github.com/dmachlin","followers_url":"https://api.github.com/users/dmachlin/followers","following_url":"https://api.github.com/users/dmachlin/following{/other_user}","gists_url":"https://api.github.com/users/dmachlin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmachlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmachlin/subscriptions","organizations_url":"https://api.github.com/users/dmachlin/orgs","repos_url":"https://api.github.com/users/dmachlin/repos","events_url":"https://api.github.com/users/dmachlin/events{/privacy}","received_events_url":"https://api.github.com/users/dmachlin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-06-09T14:23:11Z","updated_at":"2016-06-09T15:22:08Z","closed_at":null,"body":"Hi,\r\nIt seems that in `KafkaMessageListenerContainer.java` acks are being added twice\r\nFirst, when `this.acknowledgingMessageListener.onMessage(record, new ConsumerAcknowledgment(record))` is called and eventually `ListenerConsumer.this.acks.put(this.record);` is called in `ConsumerAcknowledgment.acknowledge()` and later after `onMessage` ends `this.acks.add(record);` is called.\r\n\r\n```\r\nprivate void invokeListener(final ConsumerRecords<K, V> records) {\r\n\t\t\tIterator<ConsumerRecord<K, V>> iterator = records.iterator();\r\n\t\t\twhile (iterator.hasNext() && (this.autoCommit || (this.invoker != null && this.invoker.active))) {\r\n\t\t\t\tfinal ConsumerRecord<K, V> record = iterator.next();\r\n\t\t\t\tif (this.logger.isTraceEnabled()) {\r\n\t\t\t\t\tthis.logger.trace(\"Processing \" + record);\r\n\t\t\t\t}\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (this.acknowledgingMessageListener != null) {\r\n\t\t\t\t\t\tthis.acknowledgingMessageListener.onMessage(record, new ConsumerAcknowledgment(record));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tthis.listener.onMessage(record);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.acks.add(record);\r\n\t\t\t\t\tif (this.isManualImmediateAck || this.isRecordAck) {\r\n\t\t\t\t\t\tthis.consumer.wakeup();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcatch (Exception e) {\r\n\t\t\t\t\tif (this.containerProperties.isAckOnError()) {\r\n\t\t\t\t\t\tthis.acks.add(record);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (this.containerProperties.getErrorHandler() != null) {\r\n\t\t\t\t\t\tthis.containerProperties.getErrorHandler().handle(e, record);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tthis.logger.error(\"Listener threw an exception and no error handler for \" + record, e);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n```"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/comments/224929823","html_url":"https://github.com/spring-projects/spring-kafka/issues/117#issuecomment-224929823","issue_url":"https://api.github.com/repos/spring-projects/spring-kafka/issues/117","id":224929823,"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},"created_at":"2016-06-09T15:22:08Z","updated_at":"2016-06-09T15:22:08Z","body":"By the way I don't see that we check that we provide `AcknowledgingMessageListener` if mode is `MANUAL`. \r\nOtherwise it looks like we don't acks them at all because there is nothing who takes care about `Acknowledgment`\r\nOne more bug or am I missing anything ?"}}
{"actor":{"display_login":"artembilan"}}