-
-
Save forki/c24f8a9adf2181641f4ab7c39d0d2e79 to your computer and use it in GitHub Desktop.
| let queue1 = // .. | |
| let chunkSize = 100 | |
| [<FunctionName("Start")>] | |
| let run([<QueueTrigger("start")>]content:string, log:ILogger) = | |
| let t = task { | |
| let msgs = | |
| [1..5000] | |
| |> Seq.map (fun i -> createMsg ...) | |
| |> Seq.map Newtonsoft.Json.JsonConvert.SerializeObject | |
| |> Seq.chunkBySize chunkSize | |
| |> Seq.map (fun msgs -> CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject (Seq.toArray msgs))) | |
| for msg in msgs do | |
| do! queue1.AddMessageAsync msg | |
| } | |
| t.Wait() | |
| let queue2 = // .. | |
| [<FunctionName("Expand")>] | |
| let run([<QueueTrigger("expand")>]content:string, log:ILogger) = | |
| let t = task { | |
| let msgs = Newtonsoft.Json.JsonConvert.DeserializeObject<string []>(content) | |
| for msg in msgs do | |
| let message = CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject msg) | |
| do! queue2.AddMessageAsync message | |
| } | |
| t.Wait() |
let chunkSize = 100
[<FunctionName("Start")>]
let run([<QueueTrigger(StartQueue)>]content:string, log:ILogger) =
let t = task {
let msgs =
[1..5000]
|> Seq.map (fun i -> {
MeterId = i |> string
VuPeriode = "2014001"} )
|> Seq.chunkBySize chunkSize
|> Seq.map Newtonsoft.Json.JsonConvert.SerializeObject
|> Seq.map (fun msgs -> CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject (Seq.toArray msgs)))
for msg in msgs do
do! expandQueue.AddMessageAsync msg
}
t.Wait()
[<FunctionName("Expand")>]
let run([<QueueTrigger(ExpandQueue)>]content:string, log:ILogger) =
let t = task {
let msgs = Newtonsoft.Json.JsonConvert.DeserializeObject<string []>(content)
for msg in msgs do
let message = CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject msg)
do! aggregationQueue.AddMessageAsync message
}
t.Wait()
´´´let chunkSize = 100
[<FunctionName("Start")>]
let run([<QueueTrigger(StartQueue)>]content:string, log:ILogger) =
let t = task {
let msgs =
[1..5000]
|> Seq.map (fun i -> {
MeterId = i |> string
VuPeriode = "2014001"} )
|> Seq.map Newtonsoft.Json.JsonConvert.SerializeObject
|> Seq.chunkBySize chunkSize
|> Seq.map (fun msgs -> CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject (Seq.toArray msgs)))