/// <summary>
        /// Called by the message receiver to start processing a message
        /// </summary>
        /// <param name="message"></param>
        private Task ProcessReceivedMessage(BrokeredMessage message)
        {
            Envelope <Stream> envelope = WindowsServiceBusMessageConverter.ConstructEnvelope(message);
            Task messageProcess        = Task.Run(() =>
            {
                MessageReleaseAction releaseResult = InvokeMessageHandler(envelope);

                CompleteMessage(message, releaseResult);
            });

            // http://stackoverflow.com/questions/30467896/brokeredmessage-automatically-disposed-after-calling-onmessage
            // "...The received message needs to be processed in the callback function's life time..."

            _cache.AddTask(messageProcess);

            return(messageProcess);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a task - non blocking
 /// </summary>
 /// <param name="task"></param>
 public void AddTask(Task task)
 {
     _taskCache.AddTask(task, NotifyCompletion);
 }