Closed
Description
Hi
Here's code snippet from official documentation(https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#change-streams):
MessageListenerContainer container = new DefaultMessageListenerContainer(template);
container.start();
MessageListener<ChangeStreamDocument<Document>, User> listener = System.out::println;
ChangeStreamRequestOptions options = **new ChangeStreamRequestOptions("user", ChangeStreamOptions.empty());**
However current Spring Data MongoDB version (4.0.5) doesn't contain ChangeStreamRequestOptions class where constructor accepts two parameters, only three arguments:
public ChangeStreamRequestOptions(@Nullable String databaseName, @Nullable String collectionName,
ChangeStreamOptions options) {
this(databaseName, collectionName, null, options);
}
public ChangeStreamRequestOptions(@Nullable String databaseName, @Nullable String collectionName,
@Nullable Duration maxAwaitTime, ChangeStreamOptions options) {
Assert.notNull(options, "Options must not be null");
this.collectionName = collectionName;
this.databaseName = databaseName;
this.maxAwaitTime = maxAwaitTime;
this.options = options;
}
The code snippet below doesn't compile:
Subscription subscription = container.register(new ChangeStreamRequest<>(listener, options), User.class);
with error:
Cannot infer type arguments for ChangeStreamRequest<>