Snippets tagged mailboxprocessor

  • Throttling agent

    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.

    20 people like this

    Posted: 12 years ago by Tomas Petricek

  • Agent Based Scheduler

    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:

    8 people like this

    Posted: 12 years ago by 7sharp9

  • Simple timed-expiry cache

    Basic thread-safe timed-expiry cache, implemented as a MailboxProcessor.

    5 people like this

    Posted: 12 years ago by Yusuf Motara

  • F# counter agent

    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.

    5 people like this

    Posted: 12 years ago by Tomas Petricek

  • Ping and Pong go Chunking Along

    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.

    2 people like this

    Posted: 11 years ago by Ryan Riley

  • Reporting events from agents

    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.

    2 people like this

    Posted: 11 years ago by Tomas Petricek

  • Actors with control actor

    Actors with control actor. No mutable state.

    2 people like this

    Posted: 10 years ago by Tuomas Hietanen

  • Alternative Actor Implementation for Android

    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 this

    Posted: 10 years ago by Faisal Waris

  • Event stream projection with actors

    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 this

    Posted: 9 years ago by Daniel Bradley

  • Generic command/request agent with error handling

    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 this

    Posted: 8 years ago by Anton Tcholakov

  • Message Passing: Ping Pong

    Message Passing sample inspired by Erlang Ping Pong from here:

    3 people like this

    Posted: 7 years ago by Fabio Galuppo

  • MailboxProcessor multi reader

    MailboxProcessor multi reader example

    2 people like this

    Posted: 6 years ago by Zack

  • Web Crawler

    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.

    6 people like this

    Posted: 3 years ago by Taha Hachana