File tree Expand file tree Collapse file tree
java/io/debezium/src/main/java/org/apache/beam/io/debezium Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,6 +150,18 @@ public PCollectionRowTuple expand(PCollectionRowTuple input) {
150150 readTransform
151151 .withMaxNumberOfRecords (testLimitRecords )
152152 .withMaxTimeToRun (testLimitMilliseconds );
153+ } else {
154+ if (configuration .getMaxNumberOfRecords () != null ) {
155+ readTransform =
156+ readTransform .withMaxNumberOfRecords (
157+ configuration .getMaxNumberOfRecords ());
158+ }
159+
160+ if (configuration .getMaxTimeToRun () != null ) {
161+ readTransform =
162+ readTransform .withMaxTimeToRun (
163+ configuration .getMaxTimeToRun ());
164+ }
153165 }
154166
155167 // TODO(pabloem): Database connection issues can be debugged here.
@@ -187,6 +199,14 @@ public PCollectionRowTuple expand(PCollectionRowTuple input) {
187199 @ DefaultSchema (AutoValueSchema .class )
188200 @ AutoValue
189201 public abstract static class DebeziumReadSchemaTransformConfiguration {
202+ @ Nullable
203+ @ SchemaFieldDescription ("Maximum number of records to read before stopping." )
204+ public abstract Integer getMaxNumberOfRecords ();
205+
206+ @ Nullable
207+ @ SchemaFieldDescription ("Maximum time in milliseconds to run before stopping." )
208+ public abstract Long getMaxTimeToRun ();
209+
190210 @ SchemaFieldDescription ("Username used to connect to the source database." )
191211 public abstract String getUsername ();
192212
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ pipelines:
3131 host : " {DEBEZIUM_DB[HOST]}"
3232 port : " {DEBEZIUM_DB[PORT]}"
3333 table : " {DEBEZIUM_DB[TABLE]}"
34+ max_number_of_records : 2
35+ max_time_to_run : 600000
3436 connection_properties :
3537 - " database.dbname={DEBEZIUM_DB[DATABASE]}"
3638 - " plugin.name=pgoutput"
Original file line number Diff line number Diff line change 196196 port : ' port'
197197 table : ' table'
198198 connection_properties : ' debezium_connection_properties'
199+ max_number_of_records : ' max_number_of_records'
200+ max_time_to_run : ' max_time_to_run'
199201 underlying_provider :
200202 type : beamJar
201203 transforms :
You can’t perform that action at this time.
0 commit comments