我的项目的一部分是用C++编写的工作者应用程序,在Linux上运行.我发现MS不提供C++版本的Windows Azure SDK.我需要访问Windows Azure存储队列.
是否有SDK的C++端口?有没有机会使用其他语言的SDK(即python,node.js)?或者最好的选择是使用REST API?
如果我使用Azure.Storage.Queue从队列中获取消息
queue.GetMessage(TimeSpan.FromMinutes(20));
Run Code Online (Sandbox Code Playgroud)
我可以设置可见性超时,但是当尝试使用Azure.WebJobs(SDK 0.4.0-beta)属性将webjob自动绑定到队列时
即
public static void ProcessQueueMessage([QueueTrigger("myqueue")] string message){
//do something with queue item
}
Run Code Online (Sandbox Code Playgroud)
有没有办法在属性上设置可见性超时?在JobHostConfiguration()中似乎没有选项.队列.如果无法覆盖,那么它是标准的30秒吗?
我有一个TimerTrigger函数,并且输出绑定是Azure队列。
这个想法是,计时器每10分钟运行一次,它将查看数据库中的一个视图,并迭代返回的所有行,并将它们作为消息添加到队列中。
以下是我的示例TimerTrigger。将消息添加到队列中效果很好。
但是,在我的实际情况中,有些行将需要立即执行,而另一些行则将延迟几分钟(每行变化)。我计划通过使用VisibilityTimeout处理消息来处理延迟。
不幸的是,通过字符串进行绑定无法让我设置值。CloudQueueMessage.VisiblityTimeout(以下使用)是只读的。
#r "Microsoft.WindowsAzure.Storage"
using System;
using Microsoft.WindowsAzure.Storage.Queue;
public static void Run(TimerInfo myTimer, ICollector<CloudQueueMessage> outputQueueItem, TraceWriter log)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
//- Add a message to be processed now.
CloudQueueMessage msg = new CloudQueueMessage("Now");
outputQueueItem.Add(msg);
//- Add a message to be processed later.
//- this code below won't work because NextVisibleTime is readonly.
//- is there some way to set the VisibilityTimeout property before queueing?
msg = new CloudQueueMessage("Later");
DateTime otherDate = DateTime.Now.AddMinutes(3); …Run Code Online (Sandbox Code Playgroud) 我有一个分布式应用程序,它与Azure存储队列共享负载.为了验证一切正常,我写了一个小应用程序,每10分钟运行一次并检查队列中有多少项.如果该数字高于阈值,请向我发送通知消息.
这就是我在所有队列中运行的方式:
Dictionary<string, int> dic = new Dictionary<string, int>();
foreach (CloudQueue queue in QueuesToMonitor)
{
queue.FetchAttributes();
dic.Add(queue.Name, queue.ApproximateMessageCount.HasValue ? queue.ApproximateMessageCount.Value : -1);
}
Run Code Online (Sandbox Code Playgroud)
这段代码工作正常,但它也计算隐藏的消息.我想从计数中排除这些消息(因为那些任务还没有准备好执行).
例如,我检查了我的一个队列并得到了579个项目在队列中的答案.但是,实际上没有可见的物品.我用Azure Storage Explorer验证了这一点:

如何只计算队列中的可见项?
将消息从我的c ++应用程序推送到Azure存储时,我的存储队列出现以下错误(不是BLOB-我知道其他人已经看到了blob):
请求正文太大,超过了最大允许限制。
我知道我可能需要将json缩小,但是还有其他建议吗?(如增加某处的消息大小?)
我已经尝试了一切我能想到的提高插入速度的方法.这实际上只是一些没有改进的事情.
我有一些标识符(Int64)需要发送到队列,以便我的多个工作者角色可以在其上工作,而不必担心并发.
我尝试了一个foreach循环(都带有.ToString()和BitConverter.GetBytes()):
foreach(long id in ids) {
queue.AddMessage(new CloudQueueMessage(id.ToString() /*BitConverter.GetBytes(id)*/));
}
Run Code Online (Sandbox Code Playgroud)
并行.ForAll<T>():
ids.AsParallel().ForAll(id => queue.AddMessage(new CloudMessage(id.ToString())));
Run Code Online (Sandbox Code Playgroud)
无论是本地还是同一数据中心内的WorkerRole,插入最大值为每秒5次,平均每秒4.73次.
难道我做错了什么?

我有多个消费者,在多台机器上运行,从天蓝色的存储队列中读取。如果第一个消费者从队列中读取第一条消息并使其不可见 5 分钟,那么第二个消费者会从队列中读取下一条消息还是被阻塞?
我想读取 Azure 队列存储的所有消息并将它们写入 Blob。理想情况下,我想读取 10000 或更多的批次并将它们写入 Blob。
我将 Azure Cloud Functions 与队列存储绑定用于输入,将 Blob 存储绑定用于输出,但我找不到可以让我读取 1 条以上消息的 API 或配置选项。有人知道这样的API吗?
azure azure-storage-blobs azure-storage-queues azure-functions
我目前正在设置多发布者/单订阅者体系结构,使用 Azure 存储队列来缓冲事件,并使用 Azure Functions 作为订阅者。
Publisher -> Queue -> Function
Run Code Online (Sandbox Code Playgroud)
创建功能没有问题,我想要解决的部分是如何设置相同功能的开发和生产部署。我在 Visual Studio 中创建了该函数,连接是一个常量字符串文字:
public static class FooAdded
{
[FunctionName("FooAdded")]
public static void Run([QueueTrigger("tracker-readings", Connection = "https://foo.queue.core.windows.net/?sv=...")]string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
}
}
Run Code Online (Sandbox Code Playgroud)
如何根据我部署到开发环境还是实时环境来为连接提供不同的值?