HttpSink constructor

HttpSink({
  1. required Uri endpoint,
  2. required String token,
  3. LogLevel minLevel = LogLevel.info,
  4. int batchSize = 25,
  5. Duration flushInterval = const Duration(seconds: 2),
  6. int queueCapacity = 2000,
  7. Duration initialBackoff = const Duration(seconds: 1),
  8. Duration maxBackoff = const Duration(seconds: 30),
  9. Map<String, Object?>? device,
  10. Map<String, Object?>? app,
  11. HttpSender? sender,
  12. Future<void> delay(
    1. Duration
    ) = Future<void>.delayed,
})

Creates a sink that POSTs batched records to endpoint with bearer token auth. device and app are merged into every record's JSON envelope. sender and delay, which waits out each retry backoff, are overridable for tests.

Implementation

HttpSink({
  required this._endpoint,
  required this._token,
  this._minLevel = LogLevel.info,
  this.batchSize = 25,
  this.flushInterval = const Duration(seconds: 2),
  this.queueCapacity = 2000,
  this.initialBackoff = const Duration(seconds: 1),
  this.maxBackoff = const Duration(seconds: 30),
  this._device,
  this._app,
  HttpSender? sender,
  this._delay = Future<void>.delayed,
}) : _sender = sender ?? _defaultSender;