예제 #1
0
        public VideoRepoActor()
        {
            _movieRepository = new MovieRepository();

            Receive <UserUnwatchedVideoRequest>(request =>
            {
                IActorRef actorRef = Sender;
                StartRecommendation startRecommendation = request.ResponseStartRecommendation;

                _movieRepository.GetUnseenVideosAsync(request.Videos).ContinueWith(task =>
                {
                    Video[] taskResult = task.Result;

                    actorRef.Tell(new UserUnwatchedVideoResponse(startRecommendation, taskResult));
                });
            });
        }
예제 #2
0
        public VideoRepoActor()
        {
            _movieRepository = new MovieRepository();

            Receive <UserUnwatchedVideoRequest>(request =>
            {
                IActorRef actorRef = Sender;
                StartRecommendation startRecommendation = request.ResponseStartRecommendation;

                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine($"History of videos for {request.ResponseStartRecommendation.UserId} that watched before has come, requesting for recommended videos.");
                Console.ResetColor();

                Thread.Sleep(50);

                Video[] unseenVideos = _movieRepository.GetUnseenVideos(request.Videos ?? new int[0]);

                actorRef.Tell(new UserUnwatchedVideoResponse(startRecommendation, unseenVideos));
            });
        }
 public UserWatchHistoryResponse(StartRecommendation startRecommendation, int[] videoIds)
 {
     _startRecommendation = startRecommendation;
     _videoIds            = videoIds;
 }
예제 #4
0
 public JobAttemptMessage(StartRecommendation job, bool canStart)
 {
     _job      = job;
     _canStart = canStart;
 }
 public UserUnwatchedVideoRequest(StartRecommendation responseStartRecommendation, int[] watchedVideos)
 {
     _responseStartRecommendation = responseStartRecommendation;
     _watchedVideos = watchedVideos;
 }
예제 #6
0
 public BeginAttempt(StartRecommendation startRecommendation)
 {
     _startRecommendation = startRecommendation;
 }
예제 #7
0
 public UserWatchHistoryRequest(StartRecommendation recommendation)
 {
     _recommendation = recommendation;
 }
 public UserWatchedVideoRequest(StartRecommendation attemptRecommendation)
 {
     _attemptRecommendation = attemptRecommendation;
 }