Azure 通知消息永远不会使用媒体服务到达通知队列

Azure Notification Messages never reach the notification queue using Media Services

我目前正在使用 Azure 媒体服务和 Azure 存储以及 C# web api 向应用程序添加视频服务。上传过程似乎工作正常,我可以从管理员那里看到作业成功完成的地方。控制台。

但是,如果我 运行 调试器下的应用程序,我会看到消息被添加到队列中以实际处理视频的位置,但我从未在通知队列中收到任何消息。我一直在检查代码,但我没有看到任何似乎有问题的地方。有没有人以前遇到过这个问题或者知道问题可能是什么?我目前正在调试模式下进行测试,我的连接字符串设置为 UseDevelopmentStorage=true.

// create a NotificationEndPoint queue based on the endPointAddress
string endPointAddress = "queuename";

// setup the notificationEndPoint based on the queue and endPointAddress
this.notificationEndPoint = this._context.NotificationEndPoints.Create(Guid.NewGuid().ToString(), NotificationEndPointType.AzureQueue, endPointAddress);

if (this.notificationEndPoint != null)
{
     job.JobNotificationSubscriptions.AddNew(NotificationJobState.All, this.notificationEndPoint);
     await job.SubmitAsync().ConfigureAwait(false);
      .
      .
      .



Here is the message object:
public class VideoJobNotificationMessage : AzureQueueMessage
{
// MessageVersion is used for version control. 
public string MessageVersion { get; set; }

// Type of the event. Valid values are 
// JobStateChange and NotificationEndpointRegistration.
public string EventType { get; set; }

// ETag is used to help the customer detect if 
// the message is a duplicate of another message previously sent.
public string ETag { get; set; }

// Time of occurrence of the event.
public string TimeStamp { get; set; }

// Collection of values specific to the event.
public IDictionary<string, object> Properties { get; set; }
}

来自 https://github.com/Azure/azure-sdk-for-media-services/blob/dev/test/net/Scenario/JobTests.cs 的 运行 验证测试 ShouldReceiveNotificationsForCompeletedJob 验证通知工作流程。测试正在美国西部数据中心通过。

请注意,通过 Azure 存储队列的作业通知 并非实时设计的,如您所见,队列中出现的消息之间有几分钟的延迟。

粘贴与队列创建相关的代码:

 string endPointAddress = Guid.NewGuid().ToString();
                CloudQueueClient client = CloudStorageAccount.Parse(WindowsAzureMediaServicesTestConfiguration.ClientStorageConnectionString).CreateCloudQueueClient();
                CloudQueue queue = client.GetQueueReference(endPointAddress);
                queue.CreateIfNotExists();
                string endPointName = Guid.NewGuid().ToString();
                INotificationEndPoint notificationEndPoint = _mediaContext.NotificationEndPoints.Create(endPointName, NotificationEndPointType.AzureQueue, endPointAddress);
                Assert.IsNotNull(notificationEndPoint);
 job.JobNotificationSubscriptions.AddNew(NotificationJobState.All, notificationEndPoint);

.......

            job.Submit();

            Assert.IsTrue(job.JobNotificationSubscriptions.Count > 0);

            WaitForJob(job.Id, JobState.Finished, VerifyAllTasksFinished);
            Thread.Sleep((int)TimeSpan.FromMinutes(5).TotalMilliseconds);

            Assert.IsNotNull(queue);
            Assert.IsTrue(queue.Exists());
            IEnumerable<CloudQueueMessage> messages = queue.GetMessages(10);
            Assert.IsTrue(messages.Any());
            Assert.AreEqual(4, messages.Count(), "Expecting to have 4 notifications messages");