All Projects → blehnen → Dotnetworkqueue

blehnen / Dotnetworkqueue

Licence: other
A work queue for dot.net with SQL server, SQLite, Redis and PostGreSQL backends

Projects that are alternatives of or similar to Dotnetworkqueue

Marten.fsharp
A set of FSharp wrappers around Marten
Stars: ✭ 40 (-31.03%)
Mutual labels:  dotnet-core
Aspnetauthorizationworkshop
A workshop for moving through the various new pieces in ASP.NET Core Authorization
Stars: ✭ 1,046 (+1703.45%)
Mutual labels:  dotnet-core
Subloader
Subloader is a simple and minimalistic subtitle downloader that enables you to quickly find and download subtitles for your video files.
Stars: ✭ 53 (-8.62%)
Mutual labels:  dotnet-core
Dotnet Mono
dotnet utility to run .net full apps using mono on OSX/Linux
Stars: ✭ 41 (-29.31%)
Mutual labels:  dotnet-core
Scrutiny
Randomly test state machines (such as your UI) by randomly navigating through transitions
Stars: ✭ 46 (-20.69%)
Mutual labels:  dotnet-core
Batchman
This library for Android will take any set of events and batch them up before sending it to the server. It also supports persisting the events on disk so that no event gets lost because of an app crash. Typically used for developing any in-house analytics sdk where you have to make a single api call to push events to the server but you want to optimize the calls so that the api call happens only once per x events, or say once per x minutes. It also supports exponential backoff in case of network failures
Stars: ✭ 50 (-13.79%)
Mutual labels:  job-scheduler
Asp.net Core Graphql Middleware
ASP.Net Core GraphQL Middleware
Stars: ✭ 38 (-34.48%)
Mutual labels:  dotnet-core
Yarn.msbuild
MSBuild integration for the Yarn package manager.
Stars: ✭ 57 (-1.72%)
Mutual labels:  dotnet-core
Reverse Proxy Dotnet
Reverse Proxy agent
Stars: ✭ 46 (-20.69%)
Mutual labels:  dotnet-core
Csv
Fast C# CSV parser
Stars: ✭ 53 (-8.62%)
Mutual labels:  dotnet-core
Orleanstestkit
Unit Test Toolkit for Microsoft Orleans
Stars: ✭ 42 (-27.59%)
Mutual labels:  dotnet-core
Commandline
CommandLine parser
Stars: ✭ 45 (-22.41%)
Mutual labels:  dotnet-core
Jobhub
提取各大网站有效的招聘信息(前程无忧、智联招聘、猎聘网…)
Stars: ✭ 52 (-10.34%)
Mutual labels:  dotnet-core
Localstack Dotnet Client
A lightweight .NET client for LocalStack
Stars: ✭ 40 (-31.03%)
Mutual labels:  dotnet-core
Electron.net Musicplayer Sample
Stars: ✭ 55 (-5.17%)
Mutual labels:  dotnet-core
Routine
go routine control, abstraction of the Main and some useful Executors.如果你不会管理Goroutine的话,用它
Stars: ✭ 40 (-31.03%)
Mutual labels:  job-scheduler
Jiacrontab
简单可信赖的任务管理工具
Stars: ✭ 1,052 (+1713.79%)
Mutual labels:  job-scheduler
Fakeiteasy
The easy mocking library for .NET
Stars: ✭ 1,092 (+1782.76%)
Mutual labels:  dotnet-core
Node Job Queue
Implementation of a nested asynchronous job queue in Node.js
Stars: ✭ 56 (-3.45%)
Mutual labels:  job-scheduler
Razorlight
Template engine based on Microsoft's Razor parsing engine for .NET Core
Stars: ✭ 1,068 (+1741.38%)
Mutual labels:  dotnet-core

DotNetWorkQueue

License LGPLv2.1 Build status Coverity status

A producer / distributed consumer library for dot net applications. Dot net 4.6.1, 4.7.2, 4.8 and Dot net standard 2.0 are supported

High level features

  • Queue / De-queue POCO for distributed processing
  • Queue / Process LINQ statements; compiled or dyanamic (expressed as string)
  • Re-occurring job scheduler

See the Wiki for more indepth documention

Installation

Base

Transports

Metrics

Differences between versions

Dot net standard 2.0 is missing the following features from the full framework versions

  • No support for aborting threads when stopping the consumer queues
  • No support for dynamic linq statements

Usage - POCO

[Producer - Sql server]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLServer/SQLServerProducer/Program.cs

[Producer - SQLite]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLite/SQLiteProducer/Program.cs

[Producer - Redis]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/Redis/RedisProducer/Program.cs

[Producer - PostgreSQL]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/PostgreSQL/PostgreSQLProducer/Program.cs

[Consumer - Sql server]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLServer/SQLServerConsumer/Program.cs

[Consumer - SQLite]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLite/SQLiteConsumer/Program.cs

[Consumer - Redis]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/Redis/RedisConsumer/Program.cs

[Consumer - PostgreSQL]

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/PostgreSQL/PostGreSQLConsumer/Program.cs

Usage - Linq Expression

You can choose to send Linq expressions to be executed instead. This has some advantages, as the producers and consumers are generic; they no longer need to be message specific. The below examples are not transport specifc and assume that any queue creation steps have already been performed.

NOTE: It's possbile for a producer to queue up work that a consumer cannot process. In order for a consumer to execute the Linq statement, all types must be resolvable. For dynamic statements, it's also possible to queue up work that doesn't compile due to syntax errors. That won't be discovered until the consumer dequeues the work.

####Example#####

[Producer] NOTE - if passing in the message or worker notifications as arguments to dynamic linq, you must cast them. The internal compiler treats those as objects. You can see this syntax in the examples below. That's not nessasry if using standard Linq expressions.

Message
(IReceivedMessage<MessageExpression>)

WorkerNotification
(IWorkerNotification)

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLite/SQLiteProducerLinq/Program.cs

If you are passing value types, you will need to parse them. Here is an example. The Guid and the int are both inside string literials and parsed via the built in dot.net methods.

var id = Guid.NewGuid();
var runTime = 200;
$"(message, workerNotification) => StandardTesting.Run(new Guid(\"{id}\"), int.Parse(\"{runTime}\"))"

This will produce a linq expression that can be compiled and executed by the consumer, assuming that it can resolve all of the types.

[Consumer] The consumer is generic; it can process any linq expression. However, it must be able to resolve all types that the linq expression uses. You may need to wire up an assembly resolver if your DLL's cannot be located.

https://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve(v=vs.110).aspx

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLite/SQLiteConsumerLinq/Program.cs

The above queue will process all Linq statements sent to the specified connection / queue.

[Considerations]

No sandboxing or checking for risky commands is performed. For instance, the below statement will cause your consumer host to exit.

"(message, workerNotification) => Environment.Exit(0)"

If you decide to allow configuration files to define dyanmic Linq statements (or if you cannot trust the producer), you should consider running the consumer in an application domain sandbox. Otherwise, the only thing stopping a command like the following from executing would be O/S user permissions.

"(message, workerNotification) => System.IO.Directory.Delete(@"C:\Windows\, true)"

Usage - Job Scheduler

Jobs may be scheduled using Schyntax format. The scheduler and consumers are seperate; schedulers don't process any work, they queue it for processing by a consumer. The standard LINQ consumers are used to process work enqueued by a scheduler / schedule.

Any LINQ statement that a linq producer supports can be scheduled using the scheduler.

Multiple schedulers with the same schedule may be ran if needed for redundancy. However, it's important that the clocks on the machines are in sync, or that the same time provider is injected into the schedulers and consumers. See the WIKI for more information on this.

Generally speaking, you may get funny results if you are using multiple machines and the clocks are not in sync. The server based transports tend to provide solutions for this if you can't sync the clocks of the local machines; see the WIKI.

See Schyntax for event scheduling format.

[Scheduler]

The scheduler and container must be kept in scope until you are done scheduling work or shutting down. No work will be queued if the scheduler is disposed or falls out of scope.

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLite/SQliteScheduler/Program.cs

To consume / process scheduled jobs, a Linq Consumer is used

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SQLite/SQLiteSchedulerConsumer/Program.cs


Samples

More examples

Building the source

You'll need VS2019 (any version) and you'll also need to install the dot net core 2.0 SDK

All references are either in NuGet or the \lib folder - building from Visual studio should restore any needed files.

License

Copyright � 2015-2020 Brian Lehnen

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

3rd party Libraries

This library uses multiple 3rd party libaries, listed below.

[DotNetWorkQueue]

[DotNetWorkQueue.Transport.Redis]

[DotNetWorkQueue.Transport.SqlServer]

  • None

[DotNetWorkQueue.Transport.SQLite]

[DotNetWorkQueue.Transport.SQLite.Microsoft]

[DotNetWorkQueue.Transport.PostgreSQL]

[DotNetWorkQueue.AppMetrics]

[Unit / Integration Tests]

Developed with:

Resharper dotCover dotTrace

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