Saving change stream resume token

Is your changestream code working if you ignore my example code? If not, you need to get that working first. If you do have the Changestream working, what part of the above code is not working for you? What error do you see? To me, the only part that could cause an issue is the claims.watch(pipeline) if you didn’t build the “pipeline” correctly or if a newer driver wants something different.
I posted that code well over a year ago and it is possible the example needs tweaked for a newer MongoDB java driver. We have not yet move forward with using ChangeStreams, the project is delayed until 2023.

The above code is for use after you get your ChangeStream process working and decide you want to store the resume token and/or the resume timestamp for the last document read from the ChangeStream process. You can use the stored Token or timestamp to restart your changestream at that specific point, if the document is still in the Opslog.

1 Like