Nathan, This can be tricky, especially with compressed messages (where offsets are only moved cross compressed unit). The easiest way is probably to remember the offset of the previous message yourself.
Thanks, Jun On Thu, May 31, 2012 at 12:45 AM, Nathan Marz <nathan.m...@gmail.com> wrote: > Given a MessageAndOffset object, what's the best way to get that message's > offset (and not the offset of the next message)? Would it be this: > > long actualOffset(MessageAndOffset msg) { > return msg.offset() - msg.message().serializedSize(); > } >