BAEL-2486: Changes after the editor's review. (#7199)

(cherry picked from commit 00cd1360e417a4f9be00ae6648294cc38a06c1c8)
This commit is contained in:
Drazen Nikolic 2019-06-26 20:58:08 +02:00 committed by maibin
parent 9ee237c69c
commit 21cb183c1a
2 changed files with 6 additions and 6 deletions

View File

@ -18,8 +18,8 @@ public class InfoLogsCounter implements LogsCounter {
public InfoLogsCounter(LogsRepository repository) { public InfoLogsCounter(LogsRepository repository) {
Flux<Log> stream = repository.findByLevel(LogLevel.INFO); Flux<Log> stream = repository.findByLevel(LogLevel.INFO);
this.subscription = stream.subscribe(l -> { this.subscription = stream.subscribe(logEntity -> {
log.info("INFO log received: " + l); log.info("INFO log received: " + logEntity);
counter.incrementAndGet(); counter.incrementAndGet();
}); });
} }

View File

@ -3,7 +3,7 @@ package com.baeldung.tailablecursor.service;
import com.baeldung.tailablecursor.domain.Log; import com.baeldung.tailablecursor.domain.Log;
import com.baeldung.tailablecursor.domain.LogLevel; import com.baeldung.tailablecursor.domain.LogLevel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate; import org.springframework.data.mongodb.core.ReactiveMongoOperations;
import reactor.core.Disposable; import reactor.core.Disposable;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
@ -21,10 +21,10 @@ public class WarnLogsCounter implements LogsCounter {
private final AtomicInteger counter = new AtomicInteger(); private final AtomicInteger counter = new AtomicInteger();
private final Disposable subscription; private final Disposable subscription;
public WarnLogsCounter(ReactiveMongoTemplate template) { public WarnLogsCounter(ReactiveMongoOperations template) {
Flux<Log> stream = template.tail(query(where(LEVEL_FIELD_NAME).is(LogLevel.WARN)), Log.class); Flux<Log> stream = template.tail(query(where(LEVEL_FIELD_NAME).is(LogLevel.WARN)), Log.class);
subscription = stream.subscribe(l -> { subscription = stream.subscribe(logEntity -> {
log.warn("WARN log received: " + l); log.warn("WARN log received: " + logEntity);
counter.incrementAndGet(); counter.incrementAndGet();
}); });
} }