aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/ProcessingHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-31 08:13:18 -0700
committerAnton Tananaev <anton@traccar.org>2024-03-31 08:13:18 -0700
commit301a643d62ccce053a1eaf10e5516a3d5bcc815f (patch)
treea904618d76ab7e6712ebf1289bee52f0340cd577 /src/main/java/org/traccar/ProcessingHandler.java
parent0b403da4f4fe83517110a09acb1d280396379dfb (diff)
downloadtrackermap-server-301a643d62ccce053a1eaf10e5516a3d5bcc815f.tar.gz
trackermap-server-301a643d62ccce053a1eaf10e5516a3d5bcc815f.tar.bz2
trackermap-server-301a643d62ccce053a1eaf10e5516a3d5bcc815f.zip
Extract position logger
Diffstat (limited to 'src/main/java/org/traccar/ProcessingHandler.java')
-rw-r--r--src/main/java/org/traccar/ProcessingHandler.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/ProcessingHandler.java b/src/main/java/org/traccar/ProcessingHandler.java
index 09ec79f9d..688389d98 100644
--- a/src/main/java/org/traccar/ProcessingHandler.java
+++ b/src/main/java/org/traccar/ProcessingHandler.java
@@ -51,6 +51,7 @@ import org.traccar.handler.events.MediaEventHandler;
import org.traccar.handler.events.MotionEventHandler;
import org.traccar.handler.events.OverspeedEventHandler;
import org.traccar.handler.network.AcknowledgementHandler;
+import org.traccar.helper.PositionLogger;
import org.traccar.model.Position;
import java.util.List;
@@ -64,13 +65,16 @@ import java.util.stream.Stream;
public class ProcessingHandler extends ChannelInboundHandlerAdapter {
private final NotificationManager notificationManager;
+ private final PositionLogger positionLogger;
private final List<BasePositionHandler> positionHandlers;
private final List<BaseEventHandler> eventHandlers;
private final PostProcessHandler postProcessHandler;
@Inject
- public ProcessingHandler(Injector injector, NotificationManager notificationManager) {
+ public ProcessingHandler(
+ Injector injector, NotificationManager notificationManager, PositionLogger positionLogger) {
this.notificationManager = notificationManager;
+ this.positionLogger = positionLogger;
positionHandlers = Stream.of(
TimeHandler.class,
@@ -145,7 +149,7 @@ public class ProcessingHandler extends ChannelInboundHandlerAdapter {
private void finishedProcessing(ChannelHandlerContext ctx, Position position) {
postProcessHandler.handlePosition(position, p -> {
- ctx.fireChannelRead(p);
+ positionLogger.log(ctx, p);
ctx.writeAndFlush(new AcknowledgementHandler.EventHandled(p));
});
}