Created
December 12, 2018 13:02
-
-
Save forki/c24f8a9adf2181641f4ab7c39d0d2e79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)))
[<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()