All Projects → turgayozgur → Tossit

turgayozgur / Tossit

Licence: mit
Library for distributed job/worker logic.

Projects that are alternatives of or similar to Tossit

leek
Celery Tasks Monitoring Tool
Stars: ✭ 77 (+37.5%)
Mutual labels:  rabbitmq, worker, distributed
docker-workshop-with-react-aspnetcore-redis-rabbitmq-mssql
An Asp.Net Core Docker workshop project that includes react ui, redis, mssql, rabbitmq and azure pipelines
Stars: ✭ 53 (-5.36%)
Mutual labels:  rabbitmq, dotnetcore
parallelizer
Simplifies the parallelization of function calls.
Stars: ✭ 62 (+10.71%)
Mutual labels:  job, worker
Dotnetspider
DotnetSpider, a .NET standard web crawling library. It is lightweight, efficient and fast high-level web crawling & scraping framework
Stars: ✭ 3,233 (+5673.21%)
Mutual labels:  dotnetcore, distributed
Shardingsphere Elasticjob Cloud
Stars: ✭ 248 (+342.86%)
Mutual labels:  job, distributed
rabbitmq-labs
The source code for my RabbitMQ tutorials.
Stars: ✭ 45 (-19.64%)
Mutual labels:  worker, dotnetcore
Carrot
Carrot is a .NET lightweight library that provides a couple of facilities over RabbitMQ.
Stars: ✭ 14 (-75%)
Mutual labels:  rabbitmq, dotnetcore
Arq
Fast job queuing and RPC in python with asyncio and redis.
Stars: ✭ 695 (+1141.07%)
Mutual labels:  worker, distributed
Rawrabbit
A modern .NET framework for communication over RabbitMq
Stars: ✭ 682 (+1117.86%)
Mutual labels:  rabbitmq, dotnetcore
Antares
分布式任务调度平台(Distributed Job Schedule Platform)
Stars: ✭ 558 (+896.43%)
Mutual labels:  job, distributed
Node Rethinkdb Job Queue
A persistent job or task queue backed by RethinkDB.
Stars: ✭ 158 (+182.14%)
Mutual labels:  job, distributed
Awesome Microservices Netcore
💎 A collection of awesome training series, articles, videos, books, courses, sample projects, and tools for Microservices in .NET Core
Stars: ✭ 865 (+1444.64%)
Mutual labels:  dotnetcore, distributed
Aint Queue
🚀 An async-queue library built on top of swoole, flexable multi-consumer, coroutine supported. 基于 Swoole 的一个异步队列库,可弹性伸缩的工作进程池,工作进程协程支持。
Stars: ✭ 143 (+155.36%)
Mutual labels:  job, worker
wtsqs
Simplified Node AWS SQS Worker Wrapper
Stars: ✭ 18 (-67.86%)
Mutual labels:  job, worker
Jobwanted
找工作 (喜欢就赏颗星星呗!) 【演示地址】:http://job.haojima.net
Stars: ✭ 136 (+142.86%)
Mutual labels:  job, dotnetcore
Ytask
YTask is an asynchronous task queue for handling distributed jobs in golang(go异步任务框架)
Stars: ✭ 121 (+116.07%)
Mutual labels:  job, worker
Jlitespider
A lite distributed Java spider framework :-)
Stars: ✭ 151 (+169.64%)
Mutual labels:  rabbitmq, distributed
Workq
Job server in Go
Stars: ✭ 1,546 (+2660.71%)
Mutual labels:  job, worker
Xxl Job
A distributed task scheduling framework.(分布式任务调度平台XXL-JOB)
Stars: ✭ 20,197 (+35966.07%)
Mutual labels:  job, distributed
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-57.14%)
Mutual labels:  rabbitmq, distributed

Tossit

Latest version Build Status Build status codecov Gitter

Simple, easy to use library for distributed job/worker logic. Distributed messages handled by built in RabbitMQ implementation.

Highlights

  • Super easy way to use RabbitMQ .net client for job/worker logic.
  • Connection and channel management.
  • Failure management.
  • Send and receive data that auto converted to your object types.
  • Recovery functionality. Do not worry about connection loses.

Installation

You need to install Tossit.RabbitMQ nuget package.

PM> Install-Package Tossit.RabbitMQ

Use ConfigureServices method on startup to register services.

public void ConfigureServices(IServiceCollection services)
{
    // Add RabbitMQ implementation dependencies.
    services.AddRabbitMQ();

    // Warning!
    // Call only AddTossitJob method or only AddTossitWorker method which one you need. 
    // Call both of them, if current application contains worker and job.

    // Add Tossit Job dependencies.
    services.AddTossitJob();

    // Add Tossit Worker dependencies.
    services.AddTossitWorker(); 
}

Then, use configure method to configuring RabbitMQ server and prepare workers.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    // Use RabbitMQ server.
    app.UseRabbitMQServer("amqp://guest:[email protected]");

    // Warning!
    // Call UseTossitWorker method, if current application contains worker.

    // If this application has worker(s), register it.
    app.UseTossitWorker();
}

Job Usage

Create a new class to sending to worker(s).

public class FooData
{
    public int Id { get; set; }
}

Create a new job class to dispatch data to worker(s).

public class FooJob : IJob<FooData>
{
    public FooData Data { get; set; }

    public string Name => "foo.job.name"; // Job name should be unique for each job.
}

Dispatch job using IJobDispatcher.

[Route("api/[controller]")]
public class AnyController : Controller
{
    private readonly IJobDispatcher _jobDispatcher;

    public AnyController(IJobDispatcher jobDispatcher)
    {
        _jobDispatcher = jobDispatcher;
    }

    [HttpGet]
    public IActionResult Create()
    {
        // Dispatch job.
        var isDispatched = _jobDispatcher.Dispatch(new FooJob
        {
            Data = new FooData
            {
                Id = 1
            }
        });

        return Ok();
    }
}

Send Options

  • WaitToRetrySeconds: Time as second for wait to retry when job rejects or throws an error. Should be greater then zero. Default 30 seconds.

  • ConfirmReceiptIsActive: Set true if u want to wait to see the data received successfully from a worker until timeout. Otherwise can be false. It is highly recommended to be true. Default: true.

  • ConfirmReceiptTimeoutSeconds: Wait until a dispatched data have been confirmed. Default 10 seconds.

public void ConfigureServices(IServiceCollection services)
{
    ...

    // Add Tossit Job dependencies with options.
    services.AddTossitJob(sendOptions => {
        sendOptions.WaitToRetrySeconds = 30;
        sendOptions.ConfirmReceiptIsActive = true;
        sendOptions.ConfirmReceiptTimeoutSeconds = 10;
    });

    ...
}

Worker Usage

Create new class to accept the data sent from jobs.

public class FooData
{
    public int Id { get; set; }
}

Create a new worker class to process given data.

public class FooWorker : IWorker<FooData>
{
    public string JobName => "foo.job.name"; // Should be same as dispatched job name.

    public bool Work(FooData data)
    {
        // Lets, do whatever you want by data.

        // Return true, if working completed successfully, otherwise return false.
        return true;
    }
}

License

The Tossit is open-sourced software licensed under the MIT license.

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].