aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/MainModule.java
diff options
context:
space:
mode:
authorRafael E. Ajuria <reajuria@users.noreply.github.com>2023-06-07 02:28:53 +0000
committerRafael E. Ajuria <reajuria@users.noreply.github.com>2023-06-07 02:28:53 +0000
commitcfd91d45b6731e6632ebb8a4913f807bab510707 (patch)
tree7e1ff676c5c38c0cd03854c0c1d6013c96a39acd /src/main/java/org/traccar/MainModule.java
parent3c8acbd681409a068f3428ce2cbd8cf002d0b974 (diff)
downloadtrackermap-server-cfd91d45b6731e6632ebb8a4913f807bab510707.tar.gz
trackermap-server-cfd91d45b6731e6632ebb8a4913f807bab510707.tar.bz2
trackermap-server-cfd91d45b6731e6632ebb8a4913f807bab510707.zip
redis broadcast implementation
Diffstat (limited to 'src/main/java/org/traccar/MainModule.java')
-rw-r--r--src/main/java/org/traccar/MainModule.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index 6a2fe21c3..b1a8006ee 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -28,6 +28,7 @@ import io.netty.util.Timer;
import org.apache.velocity.app.VelocityEngine;
import org.traccar.broadcast.BroadcastService;
import org.traccar.broadcast.MulticastBroadcastService;
+import org.traccar.broadcast.RedisBroadcastService;
import org.traccar.broadcast.NullBroadcastService;
import org.traccar.config.Config;
import org.traccar.config.Keys;
@@ -340,8 +341,16 @@ public class MainModule extends AbstractModule {
@Provides
public static BroadcastService provideBroadcastService(
Config config, ObjectMapper objectMapper) throws IOException {
+ String broadcastType = config.getString(Keys.BROADCAST_TYPE);
if (config.hasKey(Keys.BROADCAST_ADDRESS)) {
- return new MulticastBroadcastService(config, objectMapper);
+ switch (broadcastType) {
+ case "multicast":
+ return new MulticastBroadcastService(config, objectMapper);
+ case "redis":
+ return new RedisBroadcastService(config, objectMapper);
+ default:
+ return new NullBroadcastService();
+ }
}
return new NullBroadcastService();
}