BAEL-2486: Changes after the editor's review. (#7199)
(cherry picked from commit 00cd1360e417a4f9be00ae6648294cc38a06c1c8)
This commit is contained in:
parent
9ee237c69c
commit
21cb183c1a
|
@ -18,8 +18,8 @@ public class InfoLogsCounter implements LogsCounter {
|
|||
|
||||
public InfoLogsCounter(LogsRepository repository) {
|
||||
Flux<Log> stream = repository.findByLevel(LogLevel.INFO);
|
||||
this.subscription = stream.subscribe(l -> {
|
||||
log.info("INFO log received: " + l);
|
||||
this.subscription = stream.subscribe(logEntity -> {
|
||||
log.info("INFO log received: " + logEntity);
|
||||
counter.incrementAndGet();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.baeldung.tailablecursor.service;
|
|||
import com.baeldung.tailablecursor.domain.Log;
|
||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
||||
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.publisher.Flux;
|
||||
|
||||
|
@ -21,10 +21,10 @@ public class WarnLogsCounter implements LogsCounter {
|
|||
private final AtomicInteger counter = new AtomicInteger();
|
||||
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);
|
||||
subscription = stream.subscribe(l -> {
|
||||
log.warn("WARN log received: " + l);
|
||||
subscription = stream.subscribe(logEntity -> {
|
||||
log.warn("WARN log received: " + logEntity);
|
||||
counter.incrementAndGet();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue