consumer method

DVCaptureConsumer consumer(
  1. String name, {
  2. required DVCaptureSink sink,
  3. String? tenant,
  4. Set<String>? models,
  5. int batchSize = 500,
  6. Duration? lagThreshold,
})

A consumer: one destination's position in the log.

tenant delivers only that tenant's changes, filtered here at the source; a change with no tenant never reaches a tenant destination.

Implementation

DVCaptureConsumer consumer(
  String name, {
  required DVCaptureSink sink,
  String? tenant,
  Set<String>? models,
  int batchSize = 500,
  Duration? lagThreshold,
}) {
  if (name.trim().isEmpty) {
    throw ArgumentError.value(name, 'name', 'must not be empty');
  }
  if (batchSize < 1) {
    throw ArgumentError.value(batchSize, 'batchSize', 'must be at least 1');
  }
  final DVCaptureConsumer created = DVCaptureConsumer._(
    this,
    name,
    sink: sink,
    tenant: tenant,
    models: models == null ? null : Set<String>.unmodifiable(models),
    batchSize: batchSize,
    lagThreshold: lagThreshold,
  );
  _consumers[name] = created;
  return created;
}