diff options
author | Anton Tananaev <anton@traccar.org> | 2022-04-30 18:29:37 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-04-30 18:29:37 -0700 |
commit | 2a6e75c5d9527cb7b5b54e257fd756e717d5347a (patch) | |
tree | 9d8bd9d7302953ce4d65e458f1dd72be92e2c26b /src/main/java/org/traccar/MainEventHandler.java | |
parent | 94fa65d6961fc369923b11a60758b83ac7c3ecae (diff) | |
download | trackermap-server-2a6e75c5d9527cb7b5b54e257fd756e717d5347a.tar.gz trackermap-server-2a6e75c5d9527cb7b5b54e257fd756e717d5347a.tar.bz2 trackermap-server-2a6e75c5d9527cb7b5b54e257fd756e717d5347a.zip |
Implement cluster broadcasting
Diffstat (limited to 'src/main/java/org/traccar/MainEventHandler.java')
-rw-r--r-- | src/main/java/org/traccar/MainEventHandler.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/MainEventHandler.java b/src/main/java/org/traccar/MainEventHandler.java index a3f6f4105..0e60ac06d 100644 --- a/src/main/java/org/traccar/MainEventHandler.java +++ b/src/main/java/org/traccar/MainEventHandler.java @@ -23,12 +23,14 @@ import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.timeout.IdleStateEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.traccar.broadcast.BroadcastMessage; import org.traccar.config.Keys; import org.traccar.database.StatisticsManager; import org.traccar.helper.DateUtil; import org.traccar.model.Position; import org.traccar.storage.StorageException; +import java.io.IOException; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashSet; @@ -61,6 +63,14 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter { LOGGER.warn("Failed to update device", error); } + BroadcastMessage message = new BroadcastMessage(); + message.setPosition(position); + try { + Context.getBroadcastService().sendMessage(message); + } catch (IOException e) { + e.printStackTrace(); + } + String uniqueId = Context.getIdentityManager().getById(position.getDeviceId()).getUniqueId(); StringBuilder builder = new StringBuilder(); |