{"id":13431456,"url":"https://github.com/turgayozgur/tossit","last_synced_at":"2025-08-21T01:32:10.443Z","repository":{"id":70165366,"uuid":"79957061","full_name":"turgayozgur/tossit","owner":"turgayozgur","description":"Library for distributed job/worker logic.","archived":false,"fork":false,"pushed_at":"2022-12-08T03:42:46.000Z","size":102,"stargazers_count":61,"open_issues_count":5,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-20T03:09:55.823Z","etag":null,"topics":["distributed","dotnetcore","job","rabbitmq","worker"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/turgayozgur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-01-24T21:38:42.000Z","updated_at":"2025-07-05T11:53:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"10842406-5e7f-4f5a-84b4-e5e2c7ba2a0c","html_url":"https://github.com/turgayozgur/tossit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/turgayozgur/tossit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turgayozgur%2Ftossit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turgayozgur%2Ftossit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turgayozgur%2Ftossit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turgayozgur%2Ftossit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/turgayozgur","download_url":"https://codeload.github.com/turgayozgur/tossit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turgayozgur%2Ftossit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271415022,"owners_count":24755628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed","dotnetcore","job","rabbitmq","worker"],"created_at":"2024-07-31T02:01:03.219Z","updated_at":"2025-08-21T01:32:10.163Z","avatar_url":"https://github.com/turgayozgur.png","language":"C#","funding_links":[],"categories":["Frameworks, Libraries and Tools","Queue and Messaging","框架, 库和工具","Messaging Patterns"],"sub_categories":["Queue and Messaging","消息队列","Library"],"readme":"# Tossit #\n[![Latest version](https://img.shields.io/nuget/v/Tossit.RabbitMQ.svg)](https://www.nuget.org/packages/Tossit.RabbitMQ)\n[![Build Status](https://travis-ci.org/turgayozgur/tossit.svg?branch=master)](https://travis-ci.org/turgayozgur/tossit)\n[![Build status](https://ci.appveyor.com/api/projects/status/whuoamx1tb19jbn6/branch/master?svg=true)](https://ci.appveyor.com/project/turgayozgur/tossit/branch/master)\n![](https://github.com/turgayozgur/tossit/workflows/Main/badge.svg)\n[![codecov](https://codecov.io/gh/turgayozgur/tossit/branch/master/graph/badge.svg)](https://codecov.io/gh/turgayozgur/tossit)\n[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/tossitchat/Lobby)\n\nSimple, easy to use library for distributed job/worker logic. Distributed messages handled by built in [RabbitMQ](https://github.com/rabbitmq/rabbitmq-dotnet-client) implementation.\n## Highlights ##\n* Super easy way to use RabbitMQ .net client for job/worker logic.\n* Connection and channel management.\n* Failure management.\n* Send and receive data that auto converted to your object types.\n* Recovery functionality. Do not worry about connection loses.\n## Installation ##\nYou need to install [Tossit.RabbitMQ](https://www.nuget.org/packages/Tossit.RabbitMQ) nuget package.\n```\nPM\u003e Install-Package Tossit.RabbitMQ\n```\nUse ConfigureServices method on startup to register services.\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n    // Add RabbitMQ implementation dependencies.\n    services.AddRabbitMQ();\n\n    // Warning!\n    // Call only AddTossitJob method or only AddTossitWorker method which one you need. \n    // Call both of them, if current application contains worker and job.\n\n    // Add Tossit Job dependencies.\n    services.AddTossitJob();\n\n    // Add Tossit Worker dependencies.\n    services.AddTossitWorker(); \n}\n```\nThen, use configure method to configuring RabbitMQ server and prepare workers.\n```csharp\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)\n{\n    // Use RabbitMQ server.\n    app.UseRabbitMQServer(\"amqp://guest:guest@localhost\");\n\n    // Warning!\n    // Call UseTossitWorker method, if current application contains worker.\n\n    // If this application has worker(s), register it.\n    app.UseTossitWorker();\n}\n```\n## Job Usage ##\nCreate a new class to sending to worker(s).\n```csharp\npublic class FooData\n{\n    public int Id { get; set; }\n}\n```\nCreate a new job class to dispatch data to worker(s).\n```csharp\npublic class FooJob : IJob\u003cFooData\u003e\n{\n    public FooData Data { get; set; }\n\n    public string Name =\u003e \"foo.job.name\"; // Job name should be unique for each job.\n}\n```\nDispatch job using IJobDispatcher.\n```csharp\n[Route(\"api/[controller]\")]\npublic class AnyController : Controller\n{\n    private readonly IJobDispatcher _jobDispatcher;\n\n    public AnyController(IJobDispatcher jobDispatcher)\n    {\n        _jobDispatcher = jobDispatcher;\n    }\n\n    [HttpGet]\n    public IActionResult Create()\n    {\n        // Dispatch job.\n        var isDispatched = _jobDispatcher.Dispatch(new FooJob\n        {\n            Data = new FooData\n            {\n                Id = 1\n            }\n        });\n\n        return Ok();\n    }\n}\n```\n### Send Options ###\n* **WaitToRetrySeconds:** Time as second for wait to retry when job rejects or throws an error. Should be greater then zero. Default 30 seconds.\n\n* **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.\n\n* **ConfirmReceiptTimeoutSeconds**: Wait until a dispatched data have been confirmed. Default 10 seconds.\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n    ...\n\n    // Add Tossit Job dependencies with options.\n    services.AddTossitJob(sendOptions =\u003e {\n        sendOptions.WaitToRetrySeconds = 30;\n        sendOptions.ConfirmReceiptIsActive = true;\n        sendOptions.ConfirmReceiptTimeoutSeconds = 10;\n    });\n\n    ...\n}\n```\n## Worker Usage ##\nCreate new class to accept the data sent from jobs.\n```csharp\npublic class FooData\n{\n    public int Id { get; set; }\n}\n```\nCreate a new worker class to process given data.\n```csharp\npublic class FooWorker : IWorker\u003cFooData\u003e\n{\n    public string JobName =\u003e \"foo.job.name\"; // Should be same as dispatched job name.\n\n    public bool Work(FooData data)\n    {\n        // Lets, do whatever you want by data.\n\n        // Return true, if working completed successfully, otherwise return false.\n        return true;\n    }\n}\n```\n## License ##\nThe Tossit is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturgayozgur%2Ftossit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fturgayozgur%2Ftossit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturgayozgur%2Ftossit/lists"}