All Projects → David-Desmaisons → ComposableAsync

David-Desmaisons / ComposableAsync

Licence: MIT license
Create, compose and inject asynchronous behaviors in .Net Framework and .Net Core.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to ComposableAsync

YACLib
Yet Another Concurrency Library
Stars: ✭ 193 (+589.29%)
Mutual labels:  task, thread, concurrency
theater
Actor framework for Dart. This package makes it easier to work with isolates, create clusters of isolates.
Stars: ✭ 29 (+3.57%)
Mutual labels:  actor-model, thread, concurrency
Sobjectizer
An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.
Stars: ✭ 172 (+514.29%)
Mutual labels:  actor-model, thread, concurrency
Kommander Ios
A lightweight, pure-Swift library for manage the task execution in different threads. Through the definition a simple but powerful concept, Kommand.
Stars: ✭ 167 (+496.43%)
Mutual labels:  task, thread, concurrency
Tascalate Concurrent
Implementation of blocking (IO-Bound) cancellable java.util.concurrent.CompletionStage and related extensions to java.util.concurrent.ExecutorService-s
Stars: ✭ 144 (+414.29%)
Mutual labels:  asynchronous, concurrency, async-programming
Vue Concurrency
A library for encapsulating asynchronous operations and managing concurrency for Vue and Composition API.
Stars: ✭ 147 (+425%)
Mutual labels:  task, concurrency
debugging-async-operations-in-nodejs
Example code to accompany my blog post on debugging async operations in Node.js.
Stars: ✭ 22 (-21.43%)
Mutual labels:  asynchronous, async-programming
actors
Actor Model library for Dart.
Stars: ✭ 40 (+42.86%)
Mutual labels:  actor-model, concurrency
Actors.jl
Concurrent computing in Julia based on the Actor Model
Stars: ✭ 95 (+239.29%)
Mutual labels:  actor-model, concurrency
java-red
Effective Concurrency Modules for Java
Stars: ✭ 25 (-10.71%)
Mutual labels:  asynchronous, concurrency
rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 617 (+2103.57%)
Mutual labels:  actor-model, concurrency
Unityfx.async
Asynchronous operations (promises) for Unity3d.
Stars: ✭ 143 (+410.71%)
Mutual labels:  task, async-programming
Unitask
Provides an efficient allocation free async/await integration for Unity.
Stars: ✭ 2,547 (+8996.43%)
Mutual labels:  task, thread
Netclient Ios
Versatile HTTP Networking in Swift
Stars: ✭ 117 (+317.86%)
Mutual labels:  task, asynchronous
Hunch
Hunch provides functions like: All, First, Retry, Waterfall etc., that makes asynchronous flow control more intuitive.
Stars: ✭ 94 (+235.71%)
Mutual labels:  asynchronous, concurrency
Swimmer
🏊 Swimmer - An async task pooling and throttling utility for JS
Stars: ✭ 94 (+235.71%)
Mutual labels:  task, concurrency
bascomtask
Lightweight parallel Java tasks
Stars: ✭ 49 (+75%)
Mutual labels:  thread, concurrency
async
Synchronization and asynchronous computation package for Go
Stars: ✭ 104 (+271.43%)
Mutual labels:  asynchronous, concurrency
XAsyncSockets
XAsyncSockets is an efficient Python/MicroPython library of managed asynchronous sockets.
Stars: ✭ 28 (+0%)
Mutual labels:  asynchronous, async-programming
Taskmanager
A simple、 light(only two file)、fast 、powerful 、easy to use 、easy to extend 、 Android Library To Manager your AsyncTask/Thread/CallBack Jobqueue ! 一个超级简单,易用,轻量级,快速的异步任务管理器,类似于AsyncTask,但是比AsyncTask更好用,更易控制,从此不再写Thread ! ^_^
Stars: ✭ 25 (-10.71%)
Mutual labels:  task, thread

Composable Async

build NuGet Badge MIT License

Create, compose and inject asynchronous behaviors in .Net Framework and .Net Core.

Goal

Create asynchronous behavior

Asynchronous behaviors are implemented using IDispatcher abstraction.

Composable Async provides various dispatchers implementation:

Retry

// Create dispatcher that catch all ArgumentException and retry for ever with a delay of 200 ms
var retryDispatcher = RetryPolicy.For<ArgumentException>()
			.WithWaitBetweenRetry(TimeSpan.FromSeconds(0.2))
			.ForEver();

See more at ComposableAsync.Resilient

Circuit-Breaker

// Create dispatcher that catch all ArgumentException and retry for ever with a delay of 200 ms
var retryDispatcher = CircuitBreakerPolicy.For<TimeoutException>()
			.WithRetryAndTimeout(10, TimeSpan.FromMilliseconds(500));

See more at ComposableAsync.Resilient

Fiber

// Create dispatcher that dispatch all action on the same thread
var fiberDispatcher = Fiber.CreateMonoThreadedFiber();

See more at ComposableAsync.Concurrent

RateLimiter

// Create dispatcher that dispatch all action on the same thread
var timeConstraint = TimeLimiter.GetFromMaxCountByInterval(5, TimeSpan.FromSeconds(1));

See more at RateLimiter

Compose dispatchers

Use then extension methods to create a dispatcher that will execute sequentially dispatchers

/// <summary>
/// Returns a composed dispatcher applying the given dispatchers sequentially
/// </summary>
/// <param name="dispatcher"></param>
/// <param name="others"></param>
/// <returns></returns>
public static IDispatcher Then(this IDispatcher dispatcher, IEnumerable<IDispatcher> others)
var composed = fiberDispatcher.Then(timeConstraint);

Use dispatchers

Await dispatcher

await fiberDispatcher;
// After the await, the code executes in the dispatcher context
// In this case the code will execute on the fiber thread
Console.WriteLine($"This is fiber thread {Thread.CurrentThread.ManagedThreadId}");

As httpDelegateHandler

Transform a dispatcher into HttpMessageHandler with AsDelegatingHandler extension method:

/// Using time limiter nuget
var handler = TimeLimiter
	.GetFromMaxCountByInterval(60, TimeSpan.FromMinutes(1))
	.AsDelegatingHandler();
var client = new HttpClient(handler);

As wrapper for proxy Factory

Using ComposableAsync.Factory, with this option all methods call to the proxyfied object are wrapped using the provided dispatcher.

var retryDispatcher = RetryPolicy.For<SystemException>().ForEver();

var originalObject = new BusinessObject();
var proxyFactory = new ProxyFactory(retryDispatcher);
var proxyObject = proxyFactory.Build<IBusinessObject>(originalObject);

// The call to the originalObject will be wrapped into a retry policy for SystemException
var res = await proxyObject.Execute(cancellationToken);

Actors

ComposableAsync.Concurrent also provides an actor factory based on fiber and proxy factory.

// Instantiate actor factory
var builder = new ActorFactoryBuilder();
var factory = builder.GetActorFactory(shared: false);
// When shared is true, all actor leaves in the same thread,
// when shared is false, each actor leaves in its own thread.

// Instantiate an actor from a POCO
var fooActor = fact.Build<IFoo>(new ConcreteFoo());

See more at ComposableAsync.Concurrent

Nuget

For core functionality:

Install-Package ComposableAsync.Core

For factories:

Install-Package ComposableAsync.Factory

For actors:

Install-Package ComposableAsync.Concurrent

For retry and circuit-breaker:

Install-Package ComposableAsync.Resilient

Go nuget packages

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].