What is the best way to control the container in the Azure blob for changes?

I am looking for the best way to control container / folder in Azure blob repository for changes. So far, I have found one way to do this, to start a workflow somewhere that regularly loads the contents of the container to look for changes.

Is there a better way?

+5
source share
6 answers

The Storage SDK does not provide this, but is a major feature of the new WebJobs SDK. There is an attribute [BlobInput], which allows you to specify a container for listening, and includes an efficient blob listener that will send a method when new drops are detected. There are several examples of listening to blob: http://blogs.msdn.com/b/jmstall/archive/2014/02/18/azure-storage-bindings-part-1-blobs.aspx

Here's a usage example:

    public static void CopyWithStream(
        [BlobInput("container/in/{name}")] Stream input,
        [BlobOutput("container/out1/{name}")] Stream output
        )
    {
        Debug.Assert(input.CanRead && !input.CanWrite);
        Debug.Assert(!output.CanRead && output.CanWrite);

        input.CopyTo(output);
    }

And the blob listener is here:

        JobHost host = new JobHost(acs); // From nuget: Microsoft.WindowsAzure.Jobs.Host
        host.RunAndBlock();  
+9
source

As others have said, polling within a reasonable time for your application is fine. But you do not need to check the contents. You can check ETag (if using simple HTTP) or you can check BlobProperties.LastModifiedUtc if you use API.

+4

, . .

+1

, , / blob, SignalR push- , blob , .

+1

, . - . :

-, ,

- , Run() .. . , (, - , , ). Azure Queues, - .

0

azure ? - .

0

All Articles