Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NMS-13282: Fix traffic volume tests #29

Merged
merged 1 commit into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion main/src/main/java/org/opennms/nephron/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ public class Pipeline {
* @return a new pipeline
*/
public static org.apache.beam.sdk.Pipeline create(NephronOptions options) {
Objects.requireNonNull(options);
TimestampPolicyFactory<byte[], FlowDocument> timestampPolicyFactory =
getKafkaInputTimestampPolicyFactory(Duration.millis(options.getDefaultMaxInputDelayMs()));
return create(options, timestampPolicyFactory);
}

/**
* Creates a new pipeline from the given set of runtime options using the given {@code TimestampPolicyFactory}.
*/
public static org.apache.beam.sdk.Pipeline create(
NephronOptions options,
TimestampPolicyFactory<byte[], FlowDocument> timestampPolicyFactory
) {
Objects.requireNonNull(options);
org.apache.beam.sdk.Pipeline p = org.apache.beam.sdk.Pipeline.create(options);
registerCoders(p);
Expand All @@ -132,7 +145,6 @@ public static org.apache.beam.sdk.Pipeline create(NephronOptions options) {
// Auto-commit should be disabled when checkpointing is on:
// the state in the checkpoints are used to derive the offsets instead
kafkaConsumerConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, options.getAutoCommit());
TimestampPolicyFactory<byte[], FlowDocument> timestampPolicyFactory = getKafkaInputTimestampPolicyFactory(Duration.millis(options.getDefaultMaxInputDelayMs()));
PCollection<FlowDocument> streamOfFlows = p.apply(new ReadFromKafka(options.getBootstrapServers(),
options.getFlowSourceTopic(), kafkaConsumerConfig, timestampPolicyFactory));

Expand Down
Loading