diff --git a/.gitignore b/.gitignore
index 3c4efe2..c18e480 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,261 +1,33 @@
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
*.suo
*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-x64/
-x86/
-bld/
-[Bb]in/
-[Oo]bj/
-[Ll]og/
-
-# Visual Studio 2015 cache/options directory
-.vs/
-# Uncomment if you have tasks that create the project's static files in wwwroot
-#wwwroot/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# DNX
-project.lock.json
-project.fragment.lock.json
-artifacts/
-
-*_i.c
-*_p.c
-*_i.h
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-*.VC.VC.opendb
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
*.dotCover
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
+.vs
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
+bin
+obj
+_ReSharper*
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# TODO: Comment the next line if you want to checkin your web deploy settings
-# but database connection strings (with potential passwords) will be unencrypted
-#*.pubxml
-*.publishproj
-
-# Microsoft Azure Web App publish settings. Comment the next line if you want to
-# checkin your Azure Web App publish settings, but sensitive information contained
-# in these scripts will be unencrypted
-PublishScripts/
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/packages/*
-# except build/, which is used as an MSBuild target.
-!**/packages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/packages/repositories.config
-# NuGet v3's project.json files produces more ignoreable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directories and files
-AppPackages/
-BundleArtifacts/
-Package.StoreAssociation.xml
-_pkginfo.txt
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
+*.csproj.user
+*.resharper.user
+*.resharper
+*.ReSharper
+*.cache
*~
-*.dbmdl
-*.dbproj.schemaview
-*.jfm
-*.pfx
-*.publishsettings
-node_modules/
-orleans.codegen.cs
-
-# Since there are multiple workflows, uncomment next line to ignore bower_components
-# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
-#bower_components/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
+*.swp
+*.bak
+*.orig
-# SQL Server files
-*.mdf
-*.ldf
+**/BenchmarkDotNet.Artifacts/**/*
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-paket-files/
-
-# FAKE - F# Make
-.fake/
-
-# JetBrains Rider
-.idea/
-*.sln.iml
+# osx noise
+.DS_Store
+*.DS_Store
+*.DotSettings.user
-# CodeRush
-.cr/
+docs/.vuepress/dist
+/node_modules
+.vscode
+.idea
+appsettings.Development.json
-# Python Tools for Visual Studio (PTVS)
-__pycache__/
-*.pyc
\ No newline at end of file
diff --git a/Sample-Quartz.sln.DotSettings b/Sample-Quartz.sln.DotSettings
new file mode 100644
index 0000000..3600297
--- /dev/null
+++ b/Sample-Quartz.sln.DotSettings
@@ -0,0 +1,197 @@
+
+ DO_NOT_SHOW
+ WARNING
+ DO_NOT_SHOW
+ OFF
+ <?xml version="1.0" encoding="utf-16"?><Profile name="Normal"><HtmlReformatCode>True</HtmlReformatCode><JsReformatCode>True</JsReformatCode><XMLReformatCode>True</XMLReformatCode><CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" /><CssReformatCode>True</CssReformatCode><VBReformatCode>True</VBReformatCode><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSReorderTypeMembers>True</CSReorderTypeMembers><CSUpdateFileHeader>True</CSUpdateFileHeader><CSEnforceVarKeywordUsageSettings>True</CSEnforceVarKeywordUsageSettings><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSShortenReferences>True</CSShortenReferences><IDEA_SETTINGS><profile version="1.0">
+ <option name="myName" value="Normal" />
+</profile></IDEA_SETTINGS></Profile>
+ <?xml version="1.0" encoding="utf-16"?><Profile name="Quick"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseVar><BehavourStyle>CAN_CHANGE_BOTH</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>IMPLICIT_EXCEPT_SIMPLE_TYPES</ForeachVariableStyle></CSUseVar><CSUpdateFileHeader>True</CSUpdateFileHeader><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSReorderTypeMembers>True</CSReorderTypeMembers><CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" /><CSEnforceVarKeywordUsageSettings>True</CSEnforceVarKeywordUsageSettings><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSharpFormatDocComments>True</CSharpFormatDocComments><IDEA_SETTINGS><profile version="1.0">
+ <option name="myName" value="Quick" />
+</profile></IDEA_SETTINGS></Profile>
+ Quick
+ True
+ RequiredForMultiline
+ RequiredForMultiline
+ RequiredForMultiline
+ RequiredForMultiline
+ RequiredForMultiline
+ Implicit
+ Implicit
+ False
+ 0
+ 2
+ 2
+ True
+ True
+ True
+ OUTDENT
+ OUTDENT
+ OUTDENT
+ 1
+ False
+ False
+ False
+ False
+ 1
+ NEVER
+ False
+ False
+ NEVER
+ False
+ True
+ LINE_BREAK
+ False
+ CHOP_IF_LONG
+ True
+ True
+ CHOP_ALWAYS
+ CHOP_ALWAYS
+ CHOP_ALWAYS
+ ZeroIndent
+ ZeroIndent
+ 160
+ <?xml version="1.0" encoding="utf-16"?>
+<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
+ <TypePattern DisplayName="COM interfaces or structs">
+ <TypePattern.Match>
+ <Or>
+ <And>
+ <Kind Is="Interface" />
+ <Or>
+ <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
+ <HasAttribute Name="System.Runtime.InteropServices.ComImport" />
+ </Or>
+ </And>
+ <Kind Is="Struct" />
+ </Or>
+ </TypePattern.Match>
+ </TypePattern>
+ <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All">
+ <TypePattern.Match>
+ <And>
+ <Kind Is="Class" />
+ <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" />
+ </And>
+ </TypePattern.Match>
+ <Entry Priority="100" DisplayName="Test Methods">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <HasAttribute Name="NUnit.Framework.TestAttribute" />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Setup/Teardown Methods">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <Or>
+ <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" />
+ <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" />
+ <HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" />
+ <HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" />
+ </Or>
+ </And>
+ </Entry.Match>
+ </Entry>
+ <Entry DisplayName="All other members" />
+ </TypePattern>
+ <TypePattern DisplayName="Default Pattern">
+ <Entry Priority="100" DisplayName="Public Delegates">
+ <Entry.Match>
+ <And>
+ <Access Is="Public" />
+ <Kind Is="Delegate" />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry Priority="100" DisplayName="Public Enums">
+ <Entry.Match>
+ <And>
+ <Access Is="Public" />
+ <Kind Is="Enum" />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Static Fields and Constants">
+ <Entry.Match>
+ <Or>
+ <Kind Is="Constant" />
+ <And>
+ <Kind Is="Field" />
+ <Static />
+ </And>
+ </Or>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Kind Order="Constant Field" />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Fields">
+ <Entry.Match>
+ <And>
+ <Kind Is="Field" />
+ <Not>
+ <Static />
+ </Not>
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Readonly />
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Constructors">
+ <Entry.Match>
+ <Kind Is="Constructor" />
+ </Entry.Match>
+ <Entry.SortBy>
+ <Static />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Properties, Indexers">
+ <Entry.Match>
+ <Or>
+ <Kind Is="Property" />
+ <Kind Is="Indexer" />
+ </Or>
+ </Entry.Match>
+ </Entry>
+ <Entry Priority="100" DisplayName="Interface Implementations">
+ <Entry.Match>
+ <And>
+ <Kind Is="Member" />
+ <ImplementsInterface />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <ImplementsInterface Immediate="True" />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="All other members" />
+ <Entry DisplayName="Nested Types">
+ <Entry.Match>
+ <Kind Is="Type" />
+ </Entry.Match>
+ </Entry>
+ </TypePattern>
+</Patterns>
+ True
+ False
+ False
+ UseVarWhenEvident
+ False
+ <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AaBb" /></Policy>
+ <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy>
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AaBb_aaBb" /><ExtraRule Prefix="" Suffix="" Style="AaBb_AaBb" /></Policy>
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 516859f..d88e603 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -19,4 +19,5 @@ services:
environment:
- ASPNETCORE_URLS=http://+:80
- ConnectionStrings__quartz=Server=tcp:mssql;Database=quartznet;Persist Security Info=False;User ID=sa;Password=Quartz!DockerP4ss;Encrypt=False;TrustServerCertificate=True;
+ - RabbitMqTransport__Host=rabbitmq
diff --git a/src/Dockerfile.quartz b/src/Dockerfile.quartz
index 2eae09d..0b40579 100644
--- a/src/Dockerfile.quartz
+++ b/src/Dockerfile.quartz
@@ -7,9 +7,7 @@ RUN dotnet restore "QuartzService/QuartzService.csproj"
COPY . .
RUN dotnet publish -c Release --no-restore -o /app QuartzService/QuartzService.csproj
-FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS publish
-
-RUN apk add --no-cache icu-libs tzdata
+FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS publish
WORKDIR /app
COPY --from=build /app ./
diff --git a/src/QuartzService/CancelScheduledMessageConsumerDefinition.cs b/src/QuartzService/CancelScheduledMessageConsumerDefinition.cs
index 729c635..4a295d4 100644
--- a/src/QuartzService/CancelScheduledMessageConsumerDefinition.cs
+++ b/src/QuartzService/CancelScheduledMessageConsumerDefinition.cs
@@ -1,8 +1,9 @@
+namespace QuartzService;
+
using MassTransit;
using MassTransit.QuartzIntegration;
using MassTransit.Scheduling;
-namespace QuartzService;
public class CancelScheduledMessageConsumerDefinition :
ConsumerDefinition
diff --git a/src/QuartzService/MassTransitQuartzRegistrationExtensions.cs b/src/QuartzService/MassTransitQuartzRegistrationExtensions.cs
index f137723..c5d54ab 100644
--- a/src/QuartzService/MassTransitQuartzRegistrationExtensions.cs
+++ b/src/QuartzService/MassTransitQuartzRegistrationExtensions.cs
@@ -1,13 +1,18 @@
+namespace QuartzService;
+
using MassTransit;
using MassTransit.QuartzIntegration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
-namespace QuartzService;
public static class MassTransitQuartzRegistrationExtensions
{
- public static void AddQuartz(this IBusRegistrationConfigurator configurator)
+ ///
+ /// Add the Quartz consumers to the bus, using for configuration.
+ ///
+ ///
+ public static void AddQuartzConsumers(this IBusRegistrationConfigurator configurator)
{
configurator.AddOptions();
@@ -16,4 +21,15 @@ public static void AddQuartz(this IBusRegistrationConfigurator configurator)
configurator.AddConsumer();
configurator.AddConsumer();
}
+
+ ///
+ /// When manually configuring a receive endpoint, configure the Quartz consumers for this endpoint
+ ///
+ ///
+ ///
+ public static void ConfigureQuartzConsumers(this IReceiveEndpointConfigurator configurator, IBusRegistrationContext context)
+ {
+ configurator.ConfigureConsumer(context);
+ configurator.ConfigureConsumer(context);
+ }
}
\ No newline at end of file
diff --git a/src/QuartzService/Program.cs b/src/QuartzService/Program.cs
index a9fdd8c..0a55659 100644
--- a/src/QuartzService/Program.cs
+++ b/src/QuartzService/Program.cs
@@ -1,41 +1,35 @@
-using System.Threading.Tasks;
+namespace QuartzService;
+
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Serilog;
+using Serilog.Events;
+
-namespace QuartzService
+class Program
{
- class Program
+ static async Task Main(string[] args)
{
- static async Task Main(string[] args)
- {
- Log.Logger = new LoggerConfiguration()
- .MinimumLevel.Information()
- .MinimumLevel.Override("JobService", Serilog.Events.LogEventLevel.Debug)
- .MinimumLevel.Override("MassTransit", Serilog.Events.LogEventLevel.Debug)
- .MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Warning)
- .Enrich.FromLogContext()
- .WriteTo.Console()
- .CreateLogger();
-
- var builder = CreateHostBuilder(args);
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Information()
+ .MinimumLevel.Override("MassTransit", LogEventLevel.Debug)
+ .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
+ .Enrich.FromLogContext()
+ .WriteTo.Console()
+ .CreateLogger();
- await builder.Build().RunAsync();
- }
+ var host = CreateHostBuilder(args).Build();
- static IHostBuilder CreateHostBuilder(string[] args)
- {
- return Host.CreateDefaultBuilder(args)
- .ConfigureAppConfiguration((hostingContext, config) =>
- {
- config.AddEnvironmentVariables();
+ await host.RunAsync();
+ }
- if (args != null)
- config.AddCommandLine(args);
- })
- .UseSerilog()
- .ConfigureWebHostDefaults(builder => builder.UseStartup());
- }
+ static IHostBuilder CreateHostBuilder(string[] args)
+ {
+ return Host.CreateDefaultBuilder(args)
+ .ConfigureHostConfiguration(builder => builder.AddEnvironmentVariables())
+ .UseSerilog()
+ .ConfigureWebHostDefaults(builder => builder.UseStartup());
}
}
\ No newline at end of file
diff --git a/src/QuartzService/QuartzConfig.cs b/src/QuartzService/QuartzConfig.cs
deleted file mode 100644
index abf4ca2..0000000
--- a/src/QuartzService/QuartzConfig.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Linq;
-
-namespace QuartzService
-{
- public class QuartzConfig : Dictionary
- {
- public QuartzConfig UpdateConnectionString(string connectionString)
- {
- this["quartz.dataSource.quartzDS.connectionString"] = connectionString;
- return this;
- }
-
- public NameValueCollection ToNameValueCollection()
- {
- return this.Aggregate(new NameValueCollection(), (seed, current) =>
- {
- seed.Add(current.Key, current.Value);
- return seed;
- });
- }
- }
-}
\ No newline at end of file
diff --git a/src/QuartzService/QuartzEndpointDefinition.cs b/src/QuartzService/QuartzEndpointDefinition.cs
index fb0a150..5b24f84 100644
--- a/src/QuartzService/QuartzEndpointDefinition.cs
+++ b/src/QuartzService/QuartzEndpointDefinition.cs
@@ -1,9 +1,10 @@
+namespace QuartzService;
+
using MassTransit;
using MassTransit.Middleware;
using MassTransit.QuartzIntegration;
using Microsoft.Extensions.Options;
-namespace QuartzService;
public class QuartzEndpointDefinition :
IEndpointDefinition,
@@ -24,7 +25,7 @@ public QuartzEndpointDefinition(IOptions options)
public virtual bool IsTemporary => false;
- public virtual int? PrefetchCount => _options.ConcurrentMessageLimit;
+ public virtual int? PrefetchCount => _options.PrefetchCount;
public virtual int? ConcurrentMessageLimit => _options.ConcurrentMessageLimit;
diff --git a/src/QuartzService/QuartzService.csproj b/src/QuartzService/QuartzService.csproj
index 43370e8..20e0559 100644
--- a/src/QuartzService/QuartzService.csproj
+++ b/src/QuartzService/QuartzService.csproj
@@ -13,7 +13,6 @@
-
diff --git a/src/QuartzService/ScheduleMessageConsumerDefinition.cs b/src/QuartzService/ScheduleMessageConsumerDefinition.cs
index ab57075..c15928f 100644
--- a/src/QuartzService/ScheduleMessageConsumerDefinition.cs
+++ b/src/QuartzService/ScheduleMessageConsumerDefinition.cs
@@ -1,8 +1,9 @@
+namespace QuartzService;
+
using MassTransit;
using MassTransit.QuartzIntegration;
using MassTransit.Scheduling;
-namespace QuartzService;
public class ScheduleMessageConsumerDefinition :
ConsumerDefinition
diff --git a/src/QuartzService/SqlServerHealthCheck.cs b/src/QuartzService/SqlServerHealthCheck.cs
index cece1d8..bc93ef6 100644
--- a/src/QuartzService/SqlServerHealthCheck.cs
+++ b/src/QuartzService/SqlServerHealthCheck.cs
@@ -1,3 +1,5 @@
+namespace QuartzService;
+
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -5,7 +7,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Diagnostics.HealthChecks;
-namespace QuartzService;
public class SqlServerHealthCheck :
IHealthCheck
diff --git a/src/QuartzService/Startup.cs b/src/QuartzService/Startup.cs
index 66e4479..402494c 100644
--- a/src/QuartzService/Startup.cs
+++ b/src/QuartzService/Startup.cs
@@ -1,3 +1,5 @@
+namespace QuartzService;
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -5,7 +7,6 @@
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using MassTransit;
-using MassTransit.QuartzIntegration;
using MassTransit.Serialization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
@@ -16,23 +17,16 @@
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Quartz;
-using JsonSerializerOptions = System.Text.Json.JsonSerializerOptions;
-namespace QuartzService;
public class Startup
{
- static bool? _isRunningInContainer;
-
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
- public IConfiguration Configuration { get; }
-
- public static bool IsRunningInContainer =>
- _isRunningInContainer ??= bool.TryParse(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER"), out var inDocker) && inDocker;
+ IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
@@ -52,7 +46,10 @@ public void ConfigureServices(IServiceCollection services)
q.UseMicrosoftDependencyInjectionJobFactory();
- q.UseDefaultThreadPool(tp => { tp.MaxConcurrency = 10; });
+ q.UseDefaultThreadPool(tp =>
+ {
+ tp.MaxConcurrency = 10;
+ });
q.UseTimeZoneConverter();
@@ -75,11 +72,15 @@ public void ConfigureServices(IServiceCollection services)
services.Configure(Configuration.GetSection("QuartzEndpoint"));
+
services.AddMassTransit(x =>
{
- x.AddQuartz();
+ x.AddQuartzConsumers();
- x.UsingRabbitMq((context, cfg) => { cfg.ConfigureEndpoints(context); });
+ x.UsingRabbitMq((context, cfg) =>
+ {
+ cfg.ConfigureEndpoints(context);
+ });
});
services.AddQuartzHostedService(options =>
@@ -132,7 +133,7 @@ static string ToJsonString(HealthReport result)
}))!)
};
- var options = new JsonSerializerOptions
+ var options = new System.Text.Json.JsonSerializerOptions
{
WriteIndented = true,
};
diff --git a/src/QuartzService/appsettings.json b/src/QuartzService/appsettings.json
index 20aa642..3579182 100644
--- a/src/QuartzService/appsettings.json
+++ b/src/QuartzService/appsettings.json
@@ -1,9 +1,4 @@
{
- "Logging": {
- "LogLevel": {
- "Default": "Debug"
- }
- },
"RabbitMqTransport": {
"Host": "localhost",
"VHost": "/",
@@ -11,7 +6,8 @@
"Pass": "guest"
},
"QuartzEndpoint": {
- "QueueName": "quartz"
+ "QueueName": "quartz",
+ "PrefetchCount": 17
},
"ConnectionStrings": {
"quartz": "Server=tcp:localhost;Database=quartznet;Persist Security Info=False;User ID=sa;Password=Quartz!DockerP4ss;Encrypt=False;TrustServerCertificate=True;"