List of usage examples for com.mongodb.client.model.changestream ChangeStreamDocument getNamespace
@BsonIgnore
@Nullable
public MongoNamespace getNamespace()
From source file:org.springframework.data.mongodb.core.messaging.ChangeStreamTask.java
License:Apache License
@Override protected Message<ChangeStreamDocument<Document>, Object> createMessage(ChangeStreamDocument<Document> source, Class<Object> targetType, RequestOptions options) { // namespace might be null for eg. OperationType.INVALIDATE MongoNamespace namespace = Optional.ofNullable(source.getNamespace()) .orElse(new MongoNamespace("unknown", options.getCollectionName())); return new ChangeStreamEventMessage<>(new ChangeStreamEvent<>(source, targetType, mongoConverter), MessageProperties.builder().databaseName(namespace.getDatabaseName()) .collectionName(namespace.getCollectionName()).build()); }