コード例 #1
0
 private void OnServiceBusQueueMessage(BrokeredMessage message)
 {
     try
     {
         if (this.OnCallbackMessageReceived != null)
         {
             //Log message received:
             CallbackQueueMessageReceivedEventArgs args = new CallbackQueueMessageReceivedEventArgs
             {
                 Message = message.GetBody <string>()
             };
             this.OnCallbackMessageReceived(this, args);
         }
     }
     catch (Exception ex)
     {
         //Log error here
         // Indicates a problem, unlock message in queue.
         Logger.Instance.Error(ex, "Error in processing incoming service bus queue message!");
     }
     finally
     {
         // Remove message from queue. Even if processing message fail, we do not want to block other messages
         try
         {
             message.Complete();
         }
         catch (Exception ex)
         {
             Logger.Instance.Warning(ex, "Error in finish processing incoming service bus queue message!");
         }
     }
 }
コード例 #2
0
        private void OnFetchCallbackMessage(object sender, CallbackQueueMessageReceivedEventArgs args)
        {
            string nextMessage = args.Message;

            if (!string.IsNullOrEmpty(nextMessage))
            {
                ProcessCallbackMessage(nextMessage);
            }
        }