Github user dlaboss commented on a diff in the pull request:
https://github.com/apache/incubator-quarks/pull/49#discussion_r57580728
--- Diff:
test/svt/src/main/java/quarks/test/svt/apps/FleetManagementEmbeddedApplication.java
---
@@ -0,0 +1,107 @@
+package quarks.test.svt.apps;
+
+import java.io.PrintWriter;
+import java.util.concurrent.TimeUnit;
+
+import quarks.console.server.HttpServer;
+import quarks.metrics.Metrics;
+import quarks.providers.development.DevelopmentProvider;
+import quarks.test.svt.utils.sensor.gps.GpsSensor;
+import quarks.test.svt.utils.sensor.gps.SimulatedGeofence;
+import quarks.test.svt.utils.sensor.gps.SimulatedGpsSensor;
+import quarks.test.svt.utils.sensor.gps.GpsData;
+import quarks.topology.TStream;
+import quarks.topology.TWindow;
+import quarks.topology.Topology;
+
+
+public class FleetManagementEmbeddedApplication {
+
+ public static void main(String[] args) throws Exception {
+
+ //TODO: make these configurable properties
+ boolean trackGpsLocation = true;
+ boolean trackSpeeding = true;
+ boolean trackGeofence = true;
+ double MILES_PER_HOUR_TO_METERS_PER_SEC_MULTIPLER = 0.44704;
+
+ //TODO - get driverId from input/file and VIN from OBD
+ String driverId = "driver1";
+ String VIN = "123456";
+ int maxSpeedMph = 70;
+
+ boolean console = false;
+ if (args.length == 1 && args[0].toLowerCase().equals("console"))
+ console = true;
+
+ double maxSpeedMetersPerSec = maxSpeedMph *
MILES_PER_HOUR_TO_METERS_PER_SEC_MULTIPLER;
+ System.out.println("maxSpeedMph: " + maxSpeedMph);
+ System.out.println("maxSpeedMetersPerSec: " +
maxSpeedMetersPerSec);
+
+ DevelopmentProvider tp = new DevelopmentProvider();
+ Topology t1 = tp.newTopology("GPS topology");
+
+ // Source 1: GPS data
+ SimulatedGpsSensor g = new SimulatedGpsSensor();
+ TStream<GpsSensor> gpsSensor = t1.poll(() -> g.nextGps(), 500,
TimeUnit.MILLISECONDS);
+
+ // 1.1 Log GPS location
+ if (trackGpsLocation) {
+ TStream<GpsSensor> logGps = gpsSensor.peek(t ->
System.out.println("log GPS: " + t.toString()));
+ logGps.tag("logGps");
+ //TODO: replace print with write to Kafka
--- End diff --
Fwiw...
Seems like this Quarks topology is representing something running on a
vehicle. Do we have reason to believe that a vehicle would ever directly
access a local or remote Kafka broker to Log GPS location? A Kafka client
isn't really a lightweight thing (uses some beefy jars for accessing zookeeper,
... - see connectors/mqtt/ext). For logging, I'd think it more likely that
the topology would log to files or perhaps to a local lightweight database such
as javadb/Derby.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---