When performing an appendToStream, we get a write result back which contains a nextExpectedVersion, which is a long. The caller then receives this version, and we regularly use it to poll the read model to check when it’s available.
I have been experimenting a bit with client version 4.1.1 to see what changes need to be made. I noticed there isn’t a nextExpectedVersion anymore.
Instead there’s a nextExpectedRevision, but this is an abstract class of ExpectedRevision. One of the subclasses is a SpecificExpectedRevision, but that isn’t public, and so we can’t extract the version from that.
From 4.1.1, how do I access the next expected version?
Yeah, it wasn’t a great decision. @oskar.dudycz had to make this to work around the issue.
//This ugly hack is needed as ESDB Java client from v4 doesn't allow to access or serialise version in an elegant manner
private ETag toETag(ExpectedRevision nextExpectedRevision) throws NoSuchFieldException, IllegalAccessException {
var field = nextExpectedRevision.getClass().getDeclaredField("version");
field.setAccessible(true);
return ETag.weak(field.get(nextExpectedRevision));
}
It would be nice if we get an issue created in the client repo to address it.