I am saving off the last successfully processed offset so that I can recover in the case of a failure. I am now trying to set the offset to the saved off value and I’m having trouble figuring out how to do that. I found how to set the “LedgerOffsetOuterClass” version using its builder, but can’t figure out if that is even useful and if not how I would set it. Thanks for any guidance you can provide.
javaapi.data.LedgerOffset provides a simpler API for dealing with offsets, including conversion to/from the protobuf version. That package provides a suite of similar classes. I recommend using that if you are working with the Java protobuf output.
Keep in mind that
LEDGER_BEGIN may be the last successful offset you processed, which does not have a valid
Absolute string representation.
That is the one I tried first and I couldn’t figure out how to set the value. I have it using LedgerOffset.LedgerBegin right now but while trying to test the recoverability I have a string of the offset and I can’t figure out how to get a object of type LedgerOffset set to that string.
edit - I swear I tried to do LedgerOffset offset = new LedgerOffset.Absolute(storedOffset);
before and it didn’t work but just tried it again and it did . Probably fat fingered it without realizing. Its working now. Thanks.