Example #1
0
        /// <summary>
        /// Send <c>fanout</c> activity message
        /// </summary>
        /// <param name="userHandle">User handle</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="activityHandle">Activity handle</param>
        /// <param name="activityType">Activity type</param>
        /// <param name="actorUserHandle">Actor user handle</param>
        /// <param name="actedOnUserHandle">Acted on user handle</param>
        /// <param name="actedOnContentType">Acted on content type</param>
        /// <param name="actedOnContentHandle">Acted on content handle</param>
        /// <param name="createdTime">Created time</param>
        /// <returns>Send message task</returns>
        public async Task SendFanoutActivityMessage(
            string userHandle,
            string appHandle,
            string activityHandle,
            ActivityType activityType,
            string actorUserHandle,
            string actedOnUserHandle,
            ContentType actedOnContentType,
            string actedOnContentHandle,
            DateTime createdTime)
        {
            FanoutActivityMessage message = new FanoutActivityMessage()
            {
                UserHandle           = userHandle,
                AppHandle            = appHandle,
                ActivityHandle       = activityHandle,
                ActivityType         = activityType,
                ActorUserHandle      = actorUserHandle,
                ActedOnUserHandle    = actedOnUserHandle,
                ActedOnContentType   = actedOnContentType,
                ActedOnContentHandle = actedOnContentHandle,
                CreatedTime          = createdTime
            };

            Queue queue = await this.QueueManager.GetQueue(this.QueueIdentifier);

            await queue.SendAsync(message);
        }
 /// <summary>
 /// Process message
 /// </summary>
 /// <param name="message">Queue message</param>
 /// <returns>Process message task</returns>
 protected override async Task Process(IMessage message)
 {
     if (message is FanoutActivityMessage)
     {
         FanoutActivityMessage fanoutActivityMessage = message as FanoutActivityMessage;
         await this.activitiesManager.FanoutActivity(
             fanoutActivityMessage.UserHandle,
             fanoutActivityMessage.AppHandle,
             fanoutActivityMessage.ActivityHandle,
             fanoutActivityMessage.ActivityType,
             fanoutActivityMessage.ActorUserHandle,
             fanoutActivityMessage.ActedOnUserHandle,
             fanoutActivityMessage.ActedOnContentType,
             fanoutActivityMessage.ActedOnContentHandle,
             fanoutActivityMessage.CreatedTime);
     }
     else if (message is FanoutTopicActivityMessage)
     {
         FanoutTopicActivityMessage fanoutActivityMessage = message as FanoutTopicActivityMessage;
         await this.activitiesManager.FanoutTopicActivity(
             fanoutActivityMessage.TopicHandle,
             fanoutActivityMessage.AppHandle,
             fanoutActivityMessage.ActivityHandle,
             fanoutActivityMessage.ActivityType,
             fanoutActivityMessage.ActorUserHandle,
             fanoutActivityMessage.ActedOnUserHandle,
             fanoutActivityMessage.ActedOnContentType,
             fanoutActivityMessage.ActedOnContentHandle,
             fanoutActivityMessage.CreatedTime);
     }
 }