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

Add some documentation

parent cb97ed45
No related branches found
No related tags found
2 merge requests!86Zookeeper free workload generator,!84Gitlab CI for Theodolite-Kotlin-Quarkus
package theodolite.commons.workloadgeneration.functions;
/**
* Interface representing a message generator, which sends messages for given keys to some
* destination.
*/
@FunctionalInterface
public interface MessageGenerator {
......
package theodolite.commons.workloadgeneration.functions;
/**
* This interface describes a function that takes meta information from a string (e.g. an ID) and
* produces an object of type T.
* This interface describes a function that takes meta information from a string key and produces an
* object of type T.
*
* @param <T> the type of the objects that will be generated by the function.
*/
......
......@@ -4,6 +4,10 @@ import java.util.Properties;
import theodolite.commons.workloadgeneration.communication.kafka.KafkaRecordSender;
import titan.ccp.model.records.ActivePowerRecord;
/**
* A factory for creating {@link MessageGenerator}s that creates Titan {@link ActivePowerRecord}s
* and sends them via Kafka.
*/
public final class TitanMessageGeneratorFactory {
private final RecordSender<ActivePowerRecord> recordSender;
......@@ -12,12 +16,19 @@ public final class TitanMessageGeneratorFactory {
this.recordSender = recordSender;
}
/**
* Create a {@link MessageGenerator} that generates Titan {@link ActivePowerRecord}s with a
* constant value.
*/
public MessageGenerator forConstantValue(final double value) {
return MessageGenerator.from(
sensor -> new ActivePowerRecord(sensor, System.currentTimeMillis(), value),
this.recordSender);
}
/**
* Create a new TitanMessageGeneratorFactory for the given Kafka configuration.
*/
public static TitanMessageGeneratorFactory withKafkaConfig(
final String bootstrapServers,
final String topic,
......@@ -25,6 +36,9 @@ public final class TitanMessageGeneratorFactory {
return withKafkaConfig(bootstrapServers, topic, schemaRegistryUrl, new Properties());
}
/**
* Create a new TitanMessageGeneratorFactory for the given Kafka configuration.
*/
public static TitanMessageGeneratorFactory withKafkaConfig(
final String bootstrapServers,
final String topic,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment