use of com.amazonaws.greengrass.streammanager.model.export.IoTSiteWiseConfig in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class StreamManager method createMessageStream.
/**
* Creates a message stream where data is written to.
*
* @param msgStreamName - Name of the stream manager message stream
*/
public void createMessageStream(@NonNull String msgStreamName) {
this.msgStreamName = msgStreamName;
IoTSiteWiseConfig ioTSiteWiseConfig = new IoTSiteWiseConfig();
ioTSiteWiseConfig.setIdentifier(UUID.randomUUID().toString());
ioTSiteWiseConfig.setBatchSize(STREAM_MANAGER_SITEWISE_BATCH_SIZE);
List<IoTSiteWiseConfig> ioTSiteWiseConfigs = new ArrayList<IoTSiteWiseConfig>();
ioTSiteWiseConfigs.add(ioTSiteWiseConfig);
try {
if (streamManagerClient == null) {
streamManagerClient = StreamManagerClientFactory.standard().build();
}
streamManagerClient.createMessageStream(new MessageStreamDefinition().withName(// Required.
msgStreamName).withMaxSize(// Default is 256 MB.
STREAM_MANAGER_MAX_STREAM_SIZE).withStreamSegmentSize(// Default is 16 MB.
STREAM_MANAGER_STREAM_SEGMENT_SIZE).withTimeToLiveMillis(// By default, no TTL is enabled.
null).withStrategyOnFull(// Required.
StrategyOnFull.OverwriteOldestData).withPersistence(// Default is File.
Persistence.File).withFlushOnWrite(// Default is false.
false).withExportDefinition(new ExportDefinition().withIotSitewise(ioTSiteWiseConfigs)));
} catch (Exception ex) {
final String errorMsg = String.format("Error Creating Stream %s: %s", msgStreamName, ex.getMessage());
log.error(errorMsg);
throw new EdgeConnectorForKVSException(errorMsg, ex);
}
}
Aggregations