Search in sources :

Example 51 with EdgeConnectorForKVSConfiguration

use of com.aws.iot.edgeconnectorforkvs.model.EdgeConnectorForKVSConfiguration in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.

the class EdgeConnectorForKVSService method schedulerStartTaskCallback.

@Override
public void schedulerStartTaskCallback(Constants.@NonNull JobType jobType, @NonNull String streamName) {
    log.info("Start Scheduled Task - " + jobType.name() + " Stream: " + streamName);
    final EdgeConnectorForKVSConfiguration edgeConnectorForKVSConfiguration = edgeConnectorForKVSConfigurationMap.get(streamName);
    if (jobType == Constants.JobType.LIVE_VIDEO_STREAMING) {
        liveStreamingExecutor.submit(() -> {
            try {
                startLiveVideoStreaming(edgeConnectorForKVSConfiguration);
            } catch (Exception ex) {
                log.error("Start Live Streaming Exception ({}): {}", ex.getClass().getName(), ex.getMessage());
                edgeConnectorForKVSConfiguration.getFatalStatus().set(true);
            }
        });
    } else if (jobType == Constants.JobType.LOCAL_VIDEO_CAPTURE) {
        recorderService.submit(() -> {
            try {
                startRecordingJob(edgeConnectorForKVSConfiguration);
            } catch (Exception ex) {
                log.error("Start Recording Exception ({}): {}", ex.getClass().getName(), ex.getMessage());
                edgeConnectorForKVSConfiguration.getFatalStatus().set(true);
            }
        });
    }
}
Also used : EdgeConnectorForKVSConfiguration(com.aws.iot.edgeconnectorforkvs.model.EdgeConnectorForKVSConfiguration) TimeoutException(java.util.concurrent.TimeoutException) EdgeConnectorForKVSException(com.aws.iot.edgeconnectorforkvs.model.exceptions.EdgeConnectorForKVSException) EdgeConnectorForKVSUnrecoverableException(com.aws.iot.edgeconnectorforkvs.model.exceptions.EdgeConnectorForKVSUnrecoverableException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

EdgeConnectorForKVSConfiguration (com.aws.iot.edgeconnectorforkvs.model.EdgeConnectorForKVSConfiguration)51 Test (org.junit.jupiter.api.Test)39 ArrayList (java.util.ArrayList)37 ReentrantLock (java.util.concurrent.locks.ReentrantLock)12 VideoRecorder (com.aws.iot.edgeconnectorforkvs.videorecorder.VideoRecorder)8 VideoUploader (com.aws.iot.edgeconnectorforkvs.videouploader.VideoUploader)8 TestWatchEventCallBack (com.aws.iot.edgeconnectorforkvs.diskmanager.callback.TestWatchEventCallBack)5 VideoUploadRequestEvent (com.aws.iot.edgeconnectorforkvs.handler.VideoUploadRequestEvent)5 EdgeConnectorForKVSException (com.aws.iot.edgeconnectorforkvs.model.exceptions.EdgeConnectorForKVSException)5 PipedOutputStream (java.io.PipedOutputStream)5 WatchEvent (java.nio.file.WatchEvent)5 IOException (java.io.IOException)4 EdgeConnectorForKVSUnrecoverableException (com.aws.iot.edgeconnectorforkvs.model.exceptions.EdgeConnectorForKVSUnrecoverableException)3 PipedInputStream (java.io.PipedInputStream)3 KvsStreamingException (com.aws.iot.edgeconnectorforkvs.videouploader.model.exceptions.KvsStreamingException)2 Field (java.lang.reflect.Field)2 Path (java.nio.file.Path)2 List (java.util.List)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2