Unwatch/re-watch change stream without restarting the application

How to stop a mongodb changestream temporarily and resume it again using ReactiveMongoTemplate ?

public Flux<Example> watch() {
  final ChangeStreamOptions changeStreamOptions = ChangeStreamOptions.builder().returnFullDocumentOnUpdate().build();
  return reactiveMongoTemplate.changeStream("collection", changeStreamOptions, Example.class)
          .filter(e -> e.getOperationType() != null)

I’m trying to create a rest endpoint that should be able to stop the changestream for sometime while we do some database maintenance and then invoke the endpoint again to resume the stream from where it left off using resumeAt(timestamp)

Change stream can be unsubscribed/stopped by disposing the subscription

Disposable subscription = service.watch()

// cancel the subscription