These are chat archives for mbraceproject/MBrace.Core

1st
Mar 2015
Kostas Rontogiannis
@krontogiannis
Mar 01 2015 17:31
@lenadroid Hi, I think you might want to look into our CloudChannel primitive. Although it's lacking documentation it's fairly simple. Here is an example:
let ch = runtime.DefaultStoreClient.Channel

let spA, rpA = ch.Create<int>()
let spB, rpB = ch.Create<int>()

let workflow (rpA : IReceivePort<int>) (spB : ISendPort<int>) = 
    cloud {
        while true do
            printfn "Waiting"
            let! result = Cloud.Catch <| rpA.Receive(timeout = 1000)
            match result with
            | Choice1Of2 x -> do! spB.Send(x * x)
            | Choice2Of2 _ -> () 
    }

let job = runtime.CreateProcess(workflow rpA spB)

// Send from client
ch.Send(spA, 3)

// Receive in client
ch.Receive(rpB)


// Kill and dispose
job.Kill()
ch.Delete(rpA)
ch.Delete(rpB)