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
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
Implements the Observable.windowed function that creates an observable returning a sliding window. The function is an observable version of Seq.observable. The implementation uses a simple F# agent that keeps partial windows and sends them to an observer.
6 people like thisPosted: 13 years ago by Tomas Petricek
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
The snippet implements a simple agent that limits the number of parallelism. When created, the agent takes the maximum number of tasks it can run in parallel. When it receives a "Start" message, it will then either run the task, or store it in a queue until earlier task ha completed.
12 people like thisPosted: 10 years ago by Tomas Petricek
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
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
This is a simple implementation of an object pool using an agent (MailboxProcessor). The pool is created with an initial number of object using the specified generator. The ObjectPool has three functions: Put: An item can be 'Put' into the pool. Get: An item can be taken from the pool ToListAndClear: A list of all the items in the pool is returned and the pool is cleared.
9 people like thisPosted: 13 years ago by 7sharp9
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
Agent that keeps a cache of web pages that were downloaded previously. The agent handles messages to add and get data as well as message to clear the cache.
7 people like thisPosted: 13 years ago by Tomas Petricek
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
Implements a simple agent that lets you throttle the degree of parallelism by limiting the number of work items that are processed in parallel.
7 people like thisPosted: 10 years ago by Tomas Petricek
The aim here is to demonstrate a method of distributing work using the built in F# agent across multiple nodes in parallel the result of crawling one page might result in finding multiple new pages to fetch. This is a recursive process which will continue until no new URLs are found. The main focus is how to process a potentially indefinite queue of work across a pool of workers, rather than how to parse web pages.
6 people like thisPosted: 8 years ago by Daniel Bradley
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