小编Mar*_*ler的帖子

Azure文件系统 - 我可以"观看"还是仅轮询?

我是一位经验丰富的Windows C#开发人员,但对Azure世界来说是新手,因此在我实施一个或多个Azure云服务时试图找出"最佳实践".

我有许多(外部和我的控制之外)源,可以将文件保存到文件夹(或可能是一组文件夹).在Windows系统的当前状态下,我设置了一个FileSystemWatcher来监视文件夹,并在文件出现时引发事件.

在Azure的世界中,有什么相同的方法呢?还是有吗?

我知道我可以创建一个计时器(或睡眠)来传递一些时间(比如30秒),并轮询文件夹,但我不确定这是云环境中的"最佳"方式.

重要的是要注意我无法控制输入 - 换句话说,文件是由我无法控制的外部设备保存的; 所以我不能,例如,在保存文件时将消息推送到队列,并响应该消息......

虽然,最终,这是目标...所以我打算有一个"Watcher"服务,它将(通过事件或轮询)检测一个或多个文件的存在,并将消息推送到适当的队列以供下一个在我的工作流程中进行回应.

应该注意的是,我正在使用VS2015和最新的Azure SDK,所以我不受任何遗留的限制.

到目前为止我所拥有的基本上是这个(一个更大的代码库的片段):

storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

// Create a CloudFileClient object for credentialed access to File storage.
fileClient = storageAccount.CreateCloudFileClient();

// Obtain the file share name from the config file
string sharenameString = CloudConfigurationManager.GetSetting("NLRB.Scanning.FileSharename");

// Get a reference to the file share.
share = fileClient.GetShareReference(sharenameString);

// Ensure that the share exists.
if (share.Exists())
{
    Trace.WriteLine("Share exists.");
    // Get a reference to the root directory for the share.
    rootDir = share.GetRootDirectoryReference(); …
Run Code Online (Sandbox Code Playgroud)

c# azure

6
推荐指数
1
解决办法
1825
查看次数

标签 统计

azure ×1

c# ×1