Skip to content
Snippets Groups Projects
Commit c7bc7c30 authored by Sören Henning's avatar Sören Henning
Browse files

Clean up

parent d37ec932
No related branches found
No related tags found
No related merge requests found
Pipeline #379 canceled
...@@ -7,8 +7,8 @@ import titan.ccp.common.configuration.Configurations; ...@@ -7,8 +7,8 @@ import titan.ccp.common.configuration.Configurations;
import uc1.streamprocessing.KafkaStreamsBuilder; import uc1.streamprocessing.KafkaStreamsBuilder;
/** /**
* A microservice that manages the history and, therefore, stores and aggregates * A microservice that manages the history and, therefore, stores and aggregates incoming
* incoming measurements. * measurements.
* *
*/ */
public class HistoryService { public class HistoryService {
...@@ -19,9 +19,6 @@ public class HistoryService { ...@@ -19,9 +19,6 @@ public class HistoryService {
/** /**
* Start the service. * Start the service.
*
* @return {@link CompletableFuture} which is completed when the service is
* successfully started.
*/ */
public void run() { public void run() {
this.createKafkaStreamsApplication(); this.createKafkaStreamsApplication();
...@@ -38,7 +35,8 @@ public class HistoryService { ...@@ -38,7 +35,8 @@ public class HistoryService {
.inputTopic(this.config.getString(ConfigurationKeys.KAFKA_INPUT_TOPIC)) .inputTopic(this.config.getString(ConfigurationKeys.KAFKA_INPUT_TOPIC))
.numThreads(this.config.getInt(ConfigurationKeys.NUM_THREADS)) .numThreads(this.config.getInt(ConfigurationKeys.NUM_THREADS))
.commitIntervalMs(this.config.getInt(ConfigurationKeys.COMMIT_INTERVAL_MS)) .commitIntervalMs(this.config.getInt(ConfigurationKeys.COMMIT_INTERVAL_MS))
.cacheMaxBytesBuffering(this.config.getInt(ConfigurationKeys.CACHE_MAX_BYTES_BUFFERING)).build(); .cacheMaxBytesBuffering(this.config.getInt(ConfigurationKeys.CACHE_MAX_BYTES_BUFFERING))
.build();
this.stopEvent.thenRun(kafkaStreams::close); this.stopEvent.thenRun(kafkaStreams::close);
kafkaStreams.start(); kafkaStreams.start();
} }
......
...@@ -36,9 +36,11 @@ public class TopologyBuilder { ...@@ -36,9 +36,11 @@ public class TopologyBuilder {
public Topology build() { public Topology build() {
this.builder this.builder
.stream(this.inputTopic, .stream(this.inputTopic, Consumed.with(
Consumed.with(Serdes.String(), IMonitoringRecordSerde.serde(new ActivePowerRecordFactory()))) Serdes.String(),
.mapValues(v -> this.gson.toJson(v)).foreach((k, v) -> LOGGER.info("Key: " + k + " Value: " + v)); IMonitoringRecordSerde.serde(new ActivePowerRecordFactory())))
.mapValues(v -> this.gson.toJson(v))
.foreach((k, v) -> LOGGER.info("Key: " + k + " Value: " + v));
return this.builder.build(); return this.builder.build();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment