appendToDataStreams method

  1. @override
Future<void> appendToDataStreams(
  1. String studyDeploymentId,
  2. List<DataStreamBatch> batch, {
  3. bool compress = true,
})
override

Append a batch of data measures to corresponding data streams in studyDeploymentId.

Throws IllegalArgumentException when:

  • the studyDeploymentId of one or more sequences in batch does not match studyDeploymentId
  • the start of one or more of the sequences contained in batch precede the end of a previously appended sequence to the same data stream
  • batch contains a sequence with DataStreamId which wasn't configured for studyDeploymentId

Throws IllegalStateException when data streams for studyDeploymentId have been closed.

Implementation

@override
Future<void> appendToDataStreams(
  String studyDeploymentId,
  List<DataStreamBatch> batch, {
  bool compress = true,
}) async {
  final payload = AppendToDataStreams(studyDeploymentId, batch);

  if (compress) {
    // compress the payload and POST the byte stream to the zip endpoint
    _endpointName = DATA_STREAM_ZIP_ENDPOINT_NAME;
    await _post(
      Uri.encodeFull(rpcEndpointUri),
      body: zipJson(payload.toJson()),
    );
  } else {
    await _rpc(payload, DATA_STREAM_ENDPOINT_NAME);
  }
}