Wednesday, June 26, 2013

C#, Async Glue programming with CallReactor class

Our developers ask me: What is the "reactor"? Plainly: a reactor is a mechanism to breath-in execution flow into some object graph for asynchronous execution, usually a callback/event dispatcher. In other words - it is at least one thread of execution that REACTS to certain condition/change in data (such as property change or collection change). A classical use of reactors are event loops, i.e. the one used by the UI thread that monitors event queue and fires events (callbacks) appropriately. Reactors are ideal for multi-threaded programming when otherwise disjoint parties need to play in concert. The NFX.Glue.CallReactor class facilitates asynchronous call dispatching and provides callback mechanism upon result receipt from the server. Every instance has a dedicated thread that monitors all Call instances in the reactor. Here is how it works:
  • Call Async_* version of Glue client proxy call. It returns CallSlot instance
  • A call to Async_* method is wrapped in the new Call{} construct that remembers it in the reactor scope
  • Pass a lambda function that gets called back by the reactor
  • Optionally, the reactor .ctor takes a callback that is fired when all Calls registered with the reactor are done
The code below is taken from the WinForms-based manual test case,hence "Invoke(delegate)" to sync the callback with the UI thread.
var client1 = new MarazmContractClient(cbo.Text);
var client2 = new MarazmContractClient(cbo.Text);

    new CallReactor(false,
        finishedReactor => 
        {
            client1.Dispose(); 
            client2.Dispose();
            Invoke( (Action)( () =>
                       MessageBox.Show(finishedReactor.Context.ToString())
                        ) );
        },
        string.Empty,
        new Call( client1.Async_Echo("One"),
         (reactor, call) => reactor.Context =
           ((string)reactor.Context) + 
            call.CallSlot.GetValue()),
        new Call( client2.Async_Echo("Two"), 
         (reactor, call) => reactor.Context =
           ((string)reactor.Context) +
            call.CallSlot.GetValue()),
        new Call( client1.Async_Echo("Three"),
         (reactor, call) => reactor.Context = 
           ((string)reactor.Context) +
            call.CallSlot.GetValue())
    );

45 comments:

dody Love said...

شركة تسليك المجارى بالرياض
شركة شفط البيارات بالرياض
شركة تنظيف الخزانات بالرياض
شركة عزل الاسطح بالرياض
شركة تنظيف الشقق بالرياض
شركة تنظيف الفلل بالرياض
شركة رش المبيدات بالرياض
شركة مكافحة النمل الابيض بالرياض
شركة غسيل السجاد بالرياض
شركة كشف تسربات المياه بالرياض
شركة نقل الاثاث بالرياض
شركة رش مبيدات بأبها

Unknown said...

ugg boots
air jordan 13
air jordan shoes
beats headphones
bottega veneta outlet
burberry outlet
canada goose outlet
chanel outlet
cheap wedding dresses
coach outlet
dansko outlet
evening dresses
hermes belt
hermes birkin
hermes outlet
juicy couture outlet
kate spade outlet
mbt shoes
michael kors outlet
mizuno running
moncler coats
mulberry outlet
soccer shoes
nike outlet store
the north face outlet
oakley sunglasses
ray ban sunglasses
stuart weitzman boots
surpa sneakers
north face outlet
the north face clearance
the north face jackets
the north face outlet store
north face jackets
the north face uk
tommy hilfiger outlet
tory burch outlet
true religion jeans
vans shoes
ysl outlet

Unknown said...

ugg boots
air jordan 13
air jordan shoes
beats headphones
bottega veneta outlet
burberry outlet
canada goose outlet
chanel outlet
cheap wedding dresses
coach outlet
dansko outlet
evening dresses
hermes belt
hermes birkin
hermes outlet
juicy couture outlet
kate spade outlet
mbt shoes
michael kors outlet
mizuno running
moncler coats
mulberry outlet
soccer shoes
nike outlet store
the north face outlet
oakley sunglasses
ray ban sunglasses
stuart weitzman boots
surpa sneakers
north face outlet
the north face clearance
the north face jackets
the north face outlet store
north face jackets
the north face uk
tommy hilfiger outlet
tory burch outlet
true religion jeans
vans shoes
ysl outlet

Unknown said...

20150623meiqing
louis vuitton
louis vuitton
fitflop footwear
oakley store
kate spade outlet
ralph lauren outlet
ray ban sunglasses
jordan 8 playoffs
oakley vault
toms outlet
www.louisvuitton.com
hollister
jordan concord 11s
michael kors outlet online
chanel bags
christian louboutin outlet
coach outlet
fitflops clearance
louboutin
louis vuitton outlet
coach outlet
coach outlet store online
marc jacobs handbags
toms promo code
oakley sunglasses wholesale
lebron james basketball shoes
prada
jeremy scott shoes
oakley sunglasses
abercrombie outlet
louis vuitton
discount oakley sunglasses
christian louboutin outlet
michael kors uk
ray ban wayfarer
concords 11
kd shoes
kate spade handbags
pandora charms
abercrombie & fitch

GFHFG said...

To let people know that they have this gem, but also to give myself to bring good luck,
the http://www.kobe11elite.com Nike Kobe 10 Elite altogether and spent hundreds of thousands bought a piece of jade gold necklace to hang around the neck. As a result,
not only it and its own inseparable, a glance out others see.
One day, a friend married to his son, also went to the king. During the evening,
everyone happy, http://kobe11elite.webpaper.co/ Kobe 11 Shoes talking and laughing, Tuibeihuanzhan bustling! At this point,
the king accidentally found a more than 50-year-old man staring at his neck to see, really proud of him, then opening said: "Sir, it interested?" Then, just from the neck Remove the gem on his own to make him see, also he said triumphantly: "! Mr. appears to be a connoisseur, you appreciate it, it is not the real thing."
It took http://kobe11elite.webpaper.co/ Nike Kobe 10 Elite , earnest looked for a long time, then put it back to the king, affirmed: "The thing is true,
http://www.airjordanclearance.com Air Jordan 11 Low old, wrinkled face, bald head, teeth missing, hobbled. Seventy eighty-nine people, action difficult, poor memory, life can not take care of themselves gradually.
http://www.airjordanclearance.com Air Jordan 13 Low read in high school, working in the town government. On her second child had secondary school, engage in agriculture Agricultural Bureau.
The youngest child is unitary, never graduated from junior high school pleaded with http://www.airjordanclearance.com 2016 Hyperdunks to go to Guangdong, go back a few years ran married, kept the wife in the countryside, all kinds of places, odd jobs.
That day, http://www.airjordanclearance.com Lebron Soldier 9 big lead, the brothers how the total support father: Dad worked hard all his life, and now old, and we can not let one person he was old and sick to live in the old yard, unattended, must be happy in his later years, comfort . We mention the program.
Second child nodded yes, the youngest hum twice. http://airjordanclearance.webpaper.co/ Air Jordan 11 Low put forward their own programs: the second child and I was in the unit, the time buckle tight grip,
youngest loose, let http://airjordanclearance.webpaper.co/ Air Jordan 13 Low to do you live, and I dick monthly thousand you a man, do not give up. how is it?
A group of older children looked at http://www.underarmourcurryshoes.com Under Armour Curry Shoes , all wink, so that the original Morning serious playful atmosphere a lot.
Little long very soft white and beautiful, big eyes http://www.underarmourcurryshoes.com Under Armour Curry 1 rotation, the whole people like a porcelain doll, very cute, innocent action,

GFHFG said...

Cheap Jordans Shoes packed with weekend crowds procurement.
Womens Jordans Shoes pushing a shopping cart alone, struggling to stop and go in the crowd.
Kids Jordans Shoes had just returned from abroad, but also do not adapt so crowded,
but a lively and intimate scenes, made Jordan Shoes 2015 smiling, almost with gratitude to listen to it loud accent.
Cheap Jordans Shoesdid not know the others are not also just returned like her,
Kobe 11 Shoes excitement and joy in the heart of almost uncontrollable.
Kobe 10 Shoes pair stood silently watching videos vegetable rack in front once again enjoy the wonderful destiny.
Seven years ago, it is also them, that kobe shoes 2015 finally made the decision to go abroad.
Now Kobe 11 Shoes work together to buy something too, so eventually it together!
Fortunately,Kobe 10 Shoes go faster ah, otherwise I am afraid to hurt deeper.
Nineteen-year-old that year,Under Armour Curry 1 birthday the day before, she has always been quiet and introverted
Under Armour Curry 2 why Rose suddenly courageously to her this declaration.
Always gentle and not competing to Rose would say,Under Armour Curry Low must be love to the extreme.
But Under Armour Curry 1 rose to take what with competition?
In a declaration of war on the same day rose,under armour stephen curry lost the battle, and then fled the United States for seven years.
Why Under Armour Curry 1 Low - suddenly thought of his facial features cold that day, unfeeling words,

alicetaylor said...

You’ve written nice post, I am gonna bookmark this page, thanks for info. I actually appreciate your own position and I will be sure to come back here.
monkey go happy 2cat mario 2learn to fly 2 | happy wheels demo | mahjong online | pacman game | monkey go happy 3 | cat mario 3learn to fly 3 | happy wheels 2 | mahjong | pacman games

Unknown said...

michael kors outlet
coach factorty outlet
timberland outlet
lebron james shoes 2015
ray ban sunglasses
michael kors outlet online
christian louboutin sale
christian louboutin outlet
louis vuitton outlet
fitflops sale clearance
replica watches
oakley sunglasses wholesale
nfl jerseys
ray ban sunglasses
mont blanc pens
nike roshe flyknit
michael kors outlet
ray-ban sunglasses
louis vuitton outlet
louis vuitton outlet
fitflops
ray bans
coach outlet
air jordan retro
nike running shoes
michael kors outlet
michael kors outlet
true religion outlet
adidas shoes
ralph lauren polo
michael kors outlet clearance
michael kors outlet
coach factorty outlet
louis vuitton outlet
lebron james shoes 13
gucci
toms shoes
michael kors
toms
michael kors outlet online
20164.15wengdongdong

mmjiaxin said...

Cheap Oakley Sunglasses
nike huaraches
http://www.cheapauthenticjordans.us.com
mlb jerseys authentic
fitflop shoes
oakley sunglasses,oakley vault,oakley sunglasses cheap,oakleys,oakley.com,sunglasses outlet,cheap oakley
http://www.christian-louboutin-outlet.uk
tiffany & co
michael kors outlet online
mlb jerseys authentic
cheap air jordans
tiffany and co
michael kors outlets
nfl jerseys
michael kors purses
http://www.jordansforcheap.us.com
http://www.michaeljordanshoes.us.com
nike huarache
ralph lauren online,cheap ralph lauren
http://www.kobesneakers.com
gg

Unknown said...



Adidas Climacool Solution Adidas Scarpe Outlet
Cheap Stephen Curry 2 Shoes Store
zapatos nike air max mujer
chaussures adidas superstar 2 femmes pas cher
Nike Air Max Schuhe Günstig
Bambas Adidas Outlet
nike lunarglide 7 barato
Nike Lunarglide 6 Free Shipping
adidas neo
Nike Flyknit Roshe Run NM
Adidas ZX 850 shoes online
New Balance 996 Hombre
Moncler Jackets online
Chaussures Air Max 90
Nike Air Max 2015 Clearance
Nike Air Max 2016 Donna
Adidas Originals Pas Cher
Adidas Yeezy Boost 350
nike air max 1 ultra moire shoes
Nike Flyknit Lunar 3 - Herren Schuhe

Unknown said...

the blog is very interesting and will be much useful for us. thank you for sharing the blog with us. please keep on updating.
Seo Company in Chennai

Unknown said...


the blog is very interesting and will be much useful for us. thank you for sharing the blog with us. please keep on updating.
ROI Services in Chennai

starfall said...

I am waiting for your coming pictures. I wish you all good luck for your coming blogs and posts. Keep sharing! nick jr | minecraft games | barney

chenlili said...

true religion sale
kevin durant 8 shoes
coach factory outlet online
ugg outlet
louis vuitton handbags
cheap air jordans
golden state warriors jerseys
uggs on sale
michael kors handbags
christian louboutin wedding shoes
moncler coats
ugg boots
louis vuitton
nike tn pas cher
rolex watches
rolex watches
toms sale
ugg boots
curry 3
christian louboutin
coach outlet store online
canada goose pas cher
cheap toms
louis vuitton outlet
rolex watches
ugg boots on sale
christian louboutin outlet
coach outlet
adidas running shoes
jordan retro 4
uggs sale
cincinnati bengals jerseys
uggs pas cher
true religion uk
ray ban sunglasses
uggs on sale
ugg boots
canada goose
chenlili20160829

chenlina said...

michael kors outlet
ugg outlet
ray bans
fitflop shoes
seattle seahawks jerseys
cheap ray ban sunglasses
kate spade outlet
los angeles clippers jerseys
adidas outlet
oakley sunglasses
chenlina20161027

Games Boy said...

what is all about this information what to play
total jerkface||happywheelsdemo.in||
http://fireboyandwatergirl.co/

Unknown said...

There are lots of information about latest technology and how to get trained in them, like this have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies. By the way you are running a great blog. Thanks for sharing this.

Best Laser Clinic In Chennai

Best Implant Clinic In Chennai

John said...

cavaliers jerseys
nike roshe one
michael kors outlet store
pandora charms sale clearance
jerseys cheap
mlb jerseys
ysl bags
pandora
christian louboutin shoes
pandora bracelet
20170704yuanyuan

fgdfgcvcai said...

coach outlet
nike blazer pas cher
ugg boots
ferragamo shoes
canada goose outlet
prada sunglasses
fitflops sale clearance
oakley sunglasses
asics shoes
cazal sunglasses
20171018caihuali

تاج للخدمات المنزلية said...



شركة المثالية للتنظيف بالقطيف
شركة المثالية لتنظيف المنازل بالقطيف
شركة المثالية لتنظيف الاستراحات بالقطيف
شركة المثالية لتنظيف الشقق بالقطيف
شركة المثالية لتنظيف الفلل بالقطيف
شركة المثالية لتنظيف المجالس بالقطيف
شركة المثالية لتنظيف السجاد بالقطيف
شركة المثالية لمكافحة الحشرات بالقطيف
شركة المثالية لكشف تسربات المياه بالقطيف
شركة المثالية لتسليك المجارى بالقطيف

Unknown said...


نعتمد على فريق عمل متكامل يقوم باستخدم مواد معنية تحتوى على معطرات وأدوات تنظيف مميزة كما أننا نعتمد على مناشف لا تغير من لون الاثاث اطلاقا بل تجعله جديدا وأنيقا مميزا افضل شركة تنظيف كنب بالرياض .
شركتناشركة تنظيف سجاد بالرياض تتخصص فى القيام بأعمال تنظيف الموكيت ونظرا لحساسية التعامل مع الموكيت فشركتنا تعتمد على أدوات محددة لسلامة الموكيت وعدم تجريحه .
شركة تنظيف منازل بالرياض





Unknown said...

تعتمد ركن الذهبيه للخدمات المنزلية فى تقديم خدمات تنظيف وصيانة المكيفات على المصدقيه والامانة فــــ تقديم الخدمة
شركة تنظيف مكيفات بالرياض
https://roknalzhby.blogspot.com.eg



hooda games said...

I like your site and content. thanks for sharing the information keep updating, looking forward for more posts. Thanks

abcya | royal oil 365

cheap essay help said...

this is so nice,essay writing help

Obat Batu Empedu Alami said...

Thanks for sharing the information

Cara Mengobati Asam Lambung
Obat Atasi Alergi Dingin
Khasiat QnC Jelly Gamat
Obat Eksim Atopik
Pengobatan Herbal Penyakit Liver
Obat Paling Mujarab Diabetes Melitus

Cara Mengobati Asam Lambung said...

Thanks for sharing the information

Obat Atasi Alergi Dingin
Khasiat QnC Jelly Gamat
Obat Eksim Atopik
Pengobatan Herbal Penyakit Liver
Obat Paling Mujarab Diabetes Melitus
Obat Batu Empedu Alami

Unknown said...

2018531 leilei3915
canada goose
ray ban sunglasses
pandora outlet
coach outlet store online
pandora charms
kate spade outlet online
michael kors handbags
christian louboutin shoes
louis vuitton outlet online
true religion

blackkutty said...

The blog is extremely intriguing and will be much valuable for us. much obliged to you for offering the blog to us. it would be ideal if you continue refreshing.
Article Submission sites

Kamal said...

I like your site and substance. a debt of gratitude is in order for sharing the data continue refreshing, searching forward for more posts. Much appreciated
Article Submission sites | Technology | Education | Vyaparpages

Unknown said...

0728jejebasket running asics intersport En plus nike air huarache nm femme de cela, vous pouvez obtenir ces chaussures dans une variété de nike air flight huarache test coloris. Outre qu'elles sont vendues à chaussure nike roshe run prix l'intérieur des rues, ces guirlandes sont également offertes aux asics gel lyte iii boston tea party touristes, aux nouveaux diplômés et aux lauréats des nike air max 90 youth gs chaussures noir blanc concours, soit en tant qu'offrandes d'accueil traditionnelles, new balance boutique lyon soit en tant que symboles honorifiques de leurs réalisations. air jordan femme avec scratch

ركن كلين said...


ارخص شركة تنظيف منازل بالرياض
شركة تنظيف ستائربالرياض
شركة تنظيف فلل بالرياض
شركة تنظيف موكيت بالرياض
شركة تنظيف كنب بالرياض
شركة تنظيف مكيفات بالرياض
افضل شركة تنظيف مكيفات بالرياض
شركة تنظيف مكيفات اسبلت بالرياض
شركة غسيل مكيفات بالرياض
افضل شركة غسيل مكيفات اسبلت بالرياض
شركة كشف تسربات المياه بالرياض

شركات تنظيف بالجنوب said...




Al-Kharj Group Company is the best company in providing all solutions in Riyadh city. Solutions for Al-Kharj Municipality. The company has the best team that specializes in all household services from surface insulation, insulation of tanks, insect control, pesticides, pest control services. as soon as possibleشركة نقل عفش بالخرج
شركة تنظيف بيارات بالخرج

شركة تسليك مجاري بالخرج
شركة عزل أسطح بالخرج
شركة صيانة كهرباء بالخرج

شركة كشف تسربات المياه بالخرج
شركة رش مبيدات بالخرج
شركة عزل خزانات بالخرج





Obat Gondok Beracun Alami Dan Aman said...

Thank you for the article, hopefully the article you give can be useful.
Obat Bronkitis100% Alami Paling Ampuh
Cara Alami Untuk Mencegah Gondok Beracan
Makanan Pantangan Penderita Penyakit Gondok Beracun
Makanan Yang Sehat Untuk Penderita Bronkitis

Pengobatan Jantung Bengkak said...

Take something positive from this writing. thank you

Cara mengobati Fistula Ani
Cara Mengatasi Demensia
Cara Mengobati Lepra

Unknown said...

Please forward information like this, good work !
Obat Penghilang Varises di Betis dan Kaki
Obat Rematik Kaki
Obat Tradisional Ngilu Pada Sendi
Obat Tradisional Miom

Unknown said...

www1016
ralph lauren polo
christian louboutin
ralph lauren polo
coach outlet
adidas clothing
reebok outlet
canada goose clothing
ralph lauren uk
coach outlet
jordan shoes

Unknown said...

Your site provides useful information
thank you for sharing the information with all of us
wait for the latest information

obat sakit pinggang kecetit
obat kista ginjal tradisional

walatraherbal07 said...

The information you present on this occasion is so very inspiring.
Ciri-Ciri Kanker Payudara
Obat Tradisional Tukak Lambung
Obat Kanker Paru-Paru Alami

Unknown said...

we believe the information that you present is truly trusted, thank you for sharing

Makanan Untuk Penderita Infeksi Paru-Paru
Makanan Pantangan Untuk Penderita Nyeri Sendi
Cara Mengatasi Flu Berkepanjangan
Cara Penularan Hepatitis C
Cara Mengobati Neuropati

ирина каменская said...

You know after a hard day I decided to have fun and play games of chance I climbed a bunch of sites and only on this I understood what was happening prosperous best online casino now I sit and spend all the time on this site

dera said...

obat penghancur benjolan di leher

yanmaneee said...

adidas ultra boost
michael kors outlet store
michael kors wallet
adidas nmd r1
salvatore ferragamo belt
adidas yeezy boost
air jordan
cheap jordans
jordans
birkin bag

cara menggugurkan kandungan dan mempercepat haid said...

I thank you for the information and articles you provided

عبدالله هادى said...



شركة تنظيف شقق بالرياض
شركة تنظيف موكيت بالرياض
شركة تنظيف واجهات زجاج بالرياض
شركة تنظيف مكيفات بالرياض
شركة تنظيف كنب بالرياض
شركة تنظيف خزانات بالرياض
شركة عزل خزانات بالرياض

Unknown said...

visit this website Dolabuy Dior visit this website replica designer backpacks continue reading this Louis Vuitton Dolabuy