def publish_youtube_video_added_event(self, video_id, user_id, name, description, tags, location,
                                          preview_image_location, added_date, timestamp):
        event = YouTubeVideoAdded(video_id=UUID_to_grpc(video_id), user_id=UUID_to_grpc(user_id), name=name,
                                  description=description, tags=tags, location=location,
                                  preview_image_location=preview_image_location,
                                  added_date=datetime_to_Timestamp(added_date),
                                  timestamp=datetime_to_Timestamp(timestamp))

        self.producer.send(YOUTUBE_VIDEO_ADDED_TOPIC, event.SerializeToString())
def VideoPreview_to_SuggestedVideoPreview(video):
    return SuggestedVideoPreview(
        video_id=UUID_to_grpc(video.video_id),
        added_date=datetime_to_Timestamp(video.added_date),
        name=video.name,
        preview_image_location=video.preview_image_location,
        user_id=UUID_to_grpc(video.user_id))
示例#3
0
    def publish_user_rated_video_event(self, video_id, user_id, rating,
                                       timestamp):
        event = UserRatedVideo(
            video_id=UUID_to_grpc(video_id),
            user_id=UUID_to_grpc(user_id),
            rating=rating,
            rating_timestamp=datetime_to_Timestamp(timestamp))

        serialized_event = event.SerializeToString()
        #logging.debug('(' + str(type(serialized_event)) + ') ' + str(serialized_event))

        self.producer.send(topic=USER_RATED_VIDEO_TOPIC,
                           value=serialized_event)
示例#4
0
    def publish_user_created_event(self, user_id, first_name, last_name, email, timestamp):
        event = UserCreated(user_id=UUID_to_grpc(user_id), first_name=first_name, last_name=last_name, email=email,
                                  timestamp=datetime_to_Timestamp(timestamp))

        self.producer.send(USER_CREATED_TOPIC, event.SerializeToString())