HttpSink constructor
HttpSink({
- required Uri endpoint,
- required String token,
- LogLevel minLevel = LogLevel.info,
- int batchSize = 25,
- Duration flushInterval = const Duration(seconds: 2),
- int queueCapacity = 2000,
- Duration initialBackoff = const Duration(seconds: 1),
- Duration maxBackoff = const Duration(seconds: 30),
- Map<
String, Object?> ? device, - Map<
String, Object?> ? app, - HttpSender? sender,
- Future<
void> delay() = 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;