The Untyped Lambda Calculus encoded as actors (F#'s MailboxProcessors)
2 people like thisPosted: 13 years ago by Nick Palladinos
The snippet implements a wrapper for standard F# agent that can be cancelled using the IDisposable interface. This makes it possible to use the agent locally (e.g. inside asynchronous workflow). When it is no longer needed, the agent's body is cancelled.
11 people like thisPosted: 13 years ago by Tomas Petricek
Generic batch job processor using Mail box processor. Sending quit message using PostAndReply will ensure that all jobs are completed before returning. (Exception handling is responsibility of the job)
6 people like thisPosted: 13 years ago by Ankur Dhama
The dining philosophers problem implemented using a waiter.
5 people like thisPosted: 13 years ago by Alex Muscar
Yet another ping pong sample with agents.
5 people like thisPosted: 12 years ago by Ryan Riley
An extension of MailboxProcessor that catches all unhandled exceptions (in the body of the mailbox processor) and reports them using an event. Otherwise, the public interface is the same as for MailboxProcessor.
5 people like thisPosted: 12 years ago by Tomas Petricek
Agent that can upgrade its functionality on the fly. (F# MailboxProcessor containing function in the loop...)
5 people like thisPosted: 11 years ago by Tuomas Hietanen
Demonstration of the manyproc sample from Erlang using F# MailboxProcessor.
3 people like thisPosted: 11 years ago by Ryan Riley
Just a quick and dirty hack
2 people like thisPosted: 10 years ago by Eirik Tsarpalis
An extension of MailboxProcessor that catches all unhandled exceptions, and ensures that the user-provided function is run repeatedly until it returns normally. Based on the HandlingMailbox defined by Tomas Petricek: fssnip.net/cj
7 people like thisPosted: 9 years ago by Anthony Perez
Generic command/request agent with error handling used to serialise posted commands and requests which are defined by closures. Useful in serialising communications to an instrument with a C API.
3 people like thisPosted: 9 years ago by Anton Tcholakov
Extension to Control.Observable module to create an Observable linked to a MailboxProcessor. Messages posted to the mailbox are published to subscribers. Requires a cancelation token which when cancelled sends OnComplete to subscribers. Only the Post method is exposed from the internally created MailboxProcessor.
2 people like thisPosted: 7 years ago by Faisal Waris
Sometimes mailboxprocessor may corrupt on errors and the state is not clear. Sometimes you don't care about the existing queue, but you want to have always a processor listening.
1 people like thisPosted: 6 years ago by Tuomas Hietanen
The snippet extends a web crawler from snippet http://fssnip.net/3K. It synchronizes all printing using an additional agent (so printed text does not interleave) and the crawling function returns an asynchronous workflow that returns when crawling completes.
0 people like thisPosted: 1 year ago by Tomas Petricek
Agent that can be used for controlling the number of concurrently executing asynchronous workflows. The agent runs a specified number of operations concurrently and queues remaining pending requests. The queued work items are started as soon as one of the previous items completes.
21 people like thisPosted: 13 years ago by Tomas Petricek
An agent based scheduler, can be sent a single schedule message (ScheduleOnce) and multiple schedule message (Schedule). The schedule messages comprise of a function to receive the message, the message, an initial TimeSpan before the message is scheduled, and another timespan for the schedule repeat. Check out my blog below for more details: http://bit.ly/mK4prb
9 people like thisPosted: 13 years ago by 7sharp9
Basic thread-safe timed-expiry cache, implemented as a MailboxProcessor.
5 people like thisPosted: 13 years ago by Yusuf Motara
The snippet shows a simple F# agent that calculates average from the received values. It supports one message for adding numbers to the statistics and one for resetting the state. Moreover, the agent limits the processing rate to 1 message per second.
6 people like thisPosted: 12 years ago by Tomas Petricek
Parameterizing pong allows us to do even more fun things. Here we use a few message types to allow stateful consumption of data sent by ping to its pongs.
3 people like thisPosted: 12 years ago by Ryan Riley
This snippet shows different options for reporting events from an F# agent. The options include triggering the event directly, using a thread pool or using a specified synchronization context.
3 people like thisPosted: 12 years ago by Tomas Petricek
Actors with control actor. No mutable state.
3 people like thisPosted: 11 years ago by Tuomas Hietanen
Actor implementation (much simplified) intended for use on mobile devices. Seems to provide better memory usage behavior than native F# Mailbox Processors (MPB) (on Android). Though is not as 'smooth' as native F# MBP. Smoothness here refers to how processing is balanced between consumers and producers (most relevant to single core machines).
8 people like thisPosted: 10 years ago by Faisal Waris
An example of using an actor (MailboxProcessor) to coordinate the projection of events from an event stream into a persisted projection. This example covers handling simple concurrency conflicts via also persisting and checking the latest event ID with with projection. The update command will take the current projection and apply all new events before persisting it back. The rebuild command will ignore an existing projection and replay all events in the stream.
5 people like thisPosted: 10 years ago by Daniel Bradley
Generic command/request agent with error handling used to serialise posted commands and requests which are defined by closures. Useful in serialising communications to an instrument with a C API.
1 people like thisPosted: 9 years ago by Anton Tcholakov
Message Passing sample inspired by Erlang Ping Pong from here: http://erlang.org/doc/getting_started/conc_prog.html
3 people like thisPosted: 8 years ago by Fabio Galuppo
MailboxProcessor multi reader example
2 people like thisPosted: 6 years ago by Zack
This snippet features an F# Web crawler that i'm already using in 2 applications (slightly modified). It's based on a scalable network of communicating agents that follow URLs extracted from HTML pages until reaching the specified limit.
8 people like thisPosted: 3 years ago by Taha Hachana