Your question has more to do with the behavior of Rx (I suppose you are using Rx as I would assume .Publish() and .Return(42) are only part of Rx and not the FSharp class library) than the behavior in fsharpx.

Observable.Return
Observable.Interval
and I speculate BehaviorSubject are cold observable, which means they will start only when subscribed upon.

In case 1 & 3 the workflow has to be scheduled on the thread pool and you probably miss the event because event.Trigger(42) fires immediately & Publish actually turns the cold observable into a hot one right away and you are probably not yet subscribed.

Case 2 is working as expected because the cold observable is fired on when Async.AwaitObservable actually creates the subscription.

You might have better luck by trying Async.StartImmediate on your workflow instead of Async.Start, but I doubt it would resolve case 3.

I'll let someone else speak up for case 4 & 5.

By on 11/15/2012 6:28 AM ()

You are absolutely correct, Async.StartImmediate got case 1 working.
thx a lot.

By on 11/15/2012 6:46 AM ()

Did some testing on subjects:
Plain Subjects work, Behaviour and ReplaySubjects throw the Valuefactory error and AsyncSubject gives: "A continuation provided by Async.FromContinuations was invoked multiple times".
Anyway, off to learn more rx ;)

By on 11/15/2012 9:14 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper