A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/brthor/Gofer.NET below:

brthor/Gofer.NET: Easy C# API for Distributed Background Tasks/Jobs for .NET Core.

Gofer.NET: Easy distributed tasks/jobs for .NET Core

Read the Docs

This is a distributed job runner for .NET Standard 2.0 Applications.

Inspired by Celery for Python, it allows you to quickly queue code execution on a worker pool.

We recommend using the dotnet cli to get started, but it's not a necessity.

The dotnet cli is part of the .NET Core SDK.

We recommend using docker to start a local Redis instance for testing. Setting up a production-level Redis instance is out of the scope of this documentation.

$ docker run -d -p 127.0.0.1:6379:6379 redis:4-alpine

Open up a terminal and create a new console project to get started.

$ mkdir myProject && cd myProject
$ dotnet new console
Add the Gofer.NET NuGet package.
$ dotnet add package Gofer.NET --version 1.0.0-*

This example Program.cs shows how to queue jobs for the worker pool to process, then start a worker to go and run them.

Some important notes:

public class Program
{
    public static async Task Main(string[] args)
    {
        var redisConnectionString = "127.0.0.1:6379";
        
        // Create a Task Client connected to Redis
        var taskClient = new TaskClient(TaskQueue.Redis(redisConnectionString));
        
        // Queue up a Sample Job
        await taskClient.TaskQueue.Enqueue(() => SampleJobFunction("Hello World!"));
        
        // Start the task listener, effectively turning this process into a worker.
        // NOTE: This will loop endlessly waiting for new tasks.
        await taskClient.Listen();
    }
    
    private static void SampleJobFunction(object value)
    {
        Console.WriteLine(value.ToString());
    }
}

Read the Docs for more details.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4