I finally figured out a solution. Might not be the most straight forward but it worked.
I can restart with either the timestamp or the token.
This is all POC code. Not yet ready for production.
How I defined in my cdrConfig.class.
private BsonString token;
private BsonTimestamp startAtOperationTime;
How I captured the 2 values to insert into my collection.
BsonTimestamp startAtOperationTime = changeStreamDocument.getClusterTime().asTimestamp();
BsonDocument resumeToken = changeStreamDocument.getResumeToken().asDocument();
BsonString token = resumeToken.getString("_data");
How I built the resumeToken after receiving data back from my collection.
BsonTimestamp startAtOperationTime = cdrConfig.getStartAtOperationTime();
BsonString bsonString = cdrConfig.getToken();
BsonDocument resumeToken2.put("_data", bsonString);
How I started the changestream watch.
if (resumeToken2 != null) {
changeStream = claims.watch(pipeline).resumeAfter(resumeToken2).fullDocument(FullDocument.UPDATE_LOOKUP);
} else {
if (startAtOperationTime != null) {
changeStream = claims.watch(pipeline).startAtOperationTime(startAtOperationTime).fullDocument(FullDocument.UPDATE_LOOKUP);
} else {
changeStream = claims.watch(pipeline).fullDocument(FullDocument.UPDATE_LOOKUP);
}
}