2017-09-26 77 views
0

我們有下面的代碼QueueTrigger,我們想要在ProcessQueueMessage消息元數據(即:dequequecount,lastretrival)。有沒有辦法實現它?獲取消息metadeta隊列觸發azure webjob

public static void ProcessQueueMessage([QueueTrigger(AppConstants.AzureBlobQueue)] string message, TextWriter log, ExecutionContext context) 
    { 
     try 
     { 
      //Do Something 
      log.WriteLine(message); 
     } 
     catch (Exception ex) 
     { 
      if(message.DequeueCount == 1) 
      { 
       //Logic 1 to notify 
      } 
      if(message.DequeueCount == 2) 
      { 
       //Logic 2 to notify 
      } if(message.DequeueCount == 3) 
      { 
       //Logic 3 to notify 
      } if(message.DequeueCount == 4) 
      { 
       //Logic 4 to notify 
      } if(message.DequeueCount == 5) 
      { 
       //Logic 5 to notify 
      } 
     } 

    } 

我們有離隊計數== 5,我們要移動郵件數據庫不同的邏輯,我們可以通過隊列毒藥achive,但只是不希望添加其他webjob /功能相同。

回答

0

當然,你可以,只是從改變message類型stringCloudQueueMessage

public static void ProcessQueueMessage(
    [QueueTrigger(AppConstants.AzureBlobQueue)] CloudQueueMessage message, 
    TextWriter log, ExecutionContext context) 
相關問題