c# - Azure Job BlobTrigger path to have year month day format in the path -


i writing web job processes data dumped azure storage account in format
mystorage/data/{yyyy}/{mm}/{dd}/app.csv

what want in blobtrigger following

  void foo( blobtrigger(" mystorage/data/{yyyy}/{mm}/{dd}/app.csv") stream message, textwriter log) { } 

is possible? want todays date parsed yyyy, mm, , dd. blob should triggered based on today's date part of path of file in blob

yes, can trigger azure function such blobs. here sample function definition:

[functionname("blob")] public static void blob(     [blobtrigger("mystorage/data/{yyyy}/{mm}/{dd}/app.csv")] stream message,      string yyyy,     string mm,     string dd,     tracewriter log) {     log.info($"found {yyyy}-{mm}-{dd}"); } 

it triggered if create blob called e.g. data/2017/09/12/app.csv in container mystorage.

note won't validate date parts, take them plain strings: instance, data/a/b/c/app.csv processed. change type of input parameters int, cause binding exception non-numeric paths. parsing date manually should trivial though:

if (datetime.tryparse($"{yyyy}-{mm}-{dd}", out datetime date)) {     log.info($"found {date}"); } 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -