{"action":"opened","issue":{"url":"https://api.github.com/repos/edenhill/librdkafka/issues/335","labels_url":"https://api.github.com/repos/edenhill/librdkafka/issues/335/labels{/name}","comments_url":"https://api.github.com/repos/edenhill/librdkafka/issues/335/comments","events_url":"https://api.github.com/repos/edenhill/librdkafka/issues/335/events","html_url":"https://github.com/edenhill/librdkafka/issues/335","id":95683740,"number":335,"title":"Way to get correct offset for each message published on consumer side.","user":{"login":"rathdeep","id":13149340,"avatar_url":"https://avatars.githubusercontent.com/u/13149340?v=3","gravatar_id":"","url":"https://api.github.com/users/rathdeep","html_url":"https://github.com/rathdeep","followers_url":"https://api.github.com/users/rathdeep/followers","following_url":"https://api.github.com/users/rathdeep/following{/other_user}","gists_url":"https://api.github.com/users/rathdeep/gists{/gist_id}","starred_url":"https://api.github.com/users/rathdeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rathdeep/subscriptions","organizations_url":"https://api.github.com/users/rathdeep/orgs","repos_url":"https://api.github.com/users/rathdeep/repos","events_url":"https://api.github.com/users/rathdeep/events{/privacy}","received_events_url":"https://api.github.com/users/rathdeep/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-17T15:45:13Z","updated_at":"2015-07-17T15:45:13Z","closed_at":null,"body":"\r\nI have seen other threads regarding offset, but unable to find a correct answer.\r\n\r\nI am getting current end of queue offset by\r\n./rdkafka_example -C -b broker -t topic  -p 0.  Let’s say 30\r\n\r\nOn producer side, I am sending around 20000 messages. And in msg_delivered2, I am printing offset as shown in rdkafka_example.c.\r\nAnd I noticed, I get same offset repeated for many messages and minimum value > 30. Also maximum offset received on consumer side >30 + 20000.\r\n\r\nwhereas ./rdkafka_example -C -b broker -t topic  -p 0.  Says current end of queue offset is 30+ 20000\r\n\r\nConsumer side code is also similar to rdkafka_example.c\r\n\r\nWhile\r\n{\r\n                if (rd_kafka_produce(rkDataTopic, dataPartition,\r\n                                     \r\n               \r\n/* Poll to handle delivery reports */\r\n                rd_kafka_poll(rk, 0);\r\n}\r\n>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n\r\n\r\nNow, if I add delay between two produce, I get better results. Although it starts from 30 +1  \r\n\r\nLike \r\nWhile\r\n{\r\n                if (rd_kafka_produce(rkDataTopic, dataPartition,\r\n                                     \r\n               /* Poll to handle delivery reports */\r\n                sleep(1);\r\n                rd_kafka_poll(rk, 0);\r\n}\r\n\r\n\r\nIs this expected behavior. Basically, I want to retrieve the offset of first produced message from producer side which consumers can use.\r\n"}}