Avoid repeating last message - issue with offsets

There was a problem with the way the consumer iterator worked.
for eg: assume that there were 10 messages in the queue/topic
and you iterate over it as -

  for msg in consumer:
     print (msg)

At the end of this, 'offset' that is saved is 10.
So, if you run the above loop again, the last message (10) is repeated.

This can be fixed by adjusting the offset counter before fetching
the message