Ejemplo n.º 1
0
        /// <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);
            });

            return(messageProcess);
        }
        /// <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);
        }