Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ravendb4 #32

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
062adfe
Updatd to RavenDB4, removed .net 4.5/4.6
adsamcik Jan 21, 2018
f449d8c
Updated dependencies
adsamcik Jan 21, 2018
df5227a
Initial changes
adsamcik Jan 21, 2018
ad9e061
updated Ravendb
adsamcik Jan 23, 2018
d4f20f8
Progress
adsamcik Jan 23, 2018
50638a8
It Compiles!
adsamcik Jan 23, 2018
4ff64ac
sync
adsamcik Jan 23, 2018
ad0619c
Add initial expiry code
adsamcik Jan 23, 2018
2381c3e
Fix expiry time
adsamcik Jan 23, 2018
00d37d4
Implemented experimental expiry for WriteOnlyTrans
adsamcik Jan 23, 2018
da52cbe
Removed unused Load
adsamcik Jan 23, 2018
b18d39f
Fix building
adsamcik Jan 24, 2018
c396a98
Fix Expiration and several more issues
adsamcik Jan 24, 2018
a9a7e2b
Fix concurrency exception
adsamcik Jan 24, 2018
35cb835
Improved IDocumentSessionExtensions
adsamcik Jan 24, 2018
d7a31c7
Fix incorrect GetMetadata call
adsamcik Jan 24, 2018
893932e
Readded expiry on lock
adsamcik Jan 24, 2018
6330385
Fix job retrieval
adsamcik Jan 24, 2018
8773f51
Moved write to operations
adsamcik Jan 24, 2018
7a887c7
Fix several issues in monitoring api
adsamcik Jan 24, 2018
bdc80b7
Removed facets
adsamcik Jan 24, 2018
de76afc
Removed additional filtering
adsamcik Jan 24, 2018
07eeea8
Rewritten dequeue
adsamcik Jan 24, 2018
e56b8f4
Fixed expiry in job details
adsamcik Jan 24, 2018
a2b0896
Changed GetExpiry return value to support null
adsamcik Jan 24, 2018
abce5e4
Fix bugs with Expiration dates retrieval
adsamcik Jan 24, 2018
ab74095
Rewritten how dequeue works
adsamcik Jan 25, 2018
e08de2a
Fixed issues, cleanup
adsamcik Jan 25, 2018
44c7e28
Moved class to Extensions
adsamcik Jan 25, 2018
1ae1c0f
Fix missing using
adsamcik Jan 25, 2018
fc1f7b5
Removed unused StateHandlers
adsamcik Jan 25, 2018
4a82305
Refactoring
adsamcik Jan 25, 2018
a8aec21
Refactoring
adsamcik Jan 25, 2018
9aee9e7
Refactoring
adsamcik Jan 25, 2018
4c24a4a
Add multiple queues, Add stress test
adsamcik Jan 25, 2018
5bfdaf3
Fix something
adsamcik Jan 25, 2018
225e4fa
Fix queue names, reduced worker count
adsamcik Jan 25, 2018
6395f31
Improved tests
adsamcik Jan 26, 2018
8548aaa
Add lock to greatly reduce concurrency exceptions
adsamcik Jan 26, 2018
baa61e5
Updated AspNetCore
adsamcik Jan 26, 2018
60c672e
Add workaround for processing job request when its done
adsamcik Jan 26, 2018
df21c6c
Increased number of stresstest jobs
adsamcik Jan 26, 2018
f86c007
Add Distinct
adsamcik Jan 26, 2018
7a87782
Fix building
adsamcik Jan 26, 2018
80725c5
Increased Package version
adsamcik Jan 26, 2018
dba0dde
Improved database exists
adsamcik Jan 26, 2018
e5c84d0
Add obj extension for RemoveExpiry
adsamcik Jan 26, 2018
d98fbe0
Fix several null references, Refactoring
adsamcik Jan 26, 2018
cba14a7
Fix null reference
adsamcik Jan 26, 2018
f5cfa9c
Refactoring
adsamcik Jan 26, 2018
e522131
Refactoring
adsamcik Jan 26, 2018
d00d7cb
Add WaitForNonStaleResults
adsamcik Jan 26, 2018
af6e7d8
Add GetStore to IRepository
adsamcik Jan 26, 2018
c16e12a
Updated RavenDB to final
adsamcik Feb 10, 2018
c67daef
Improvements
adsamcik Feb 10, 2018
0bce6f8
Updates and test changes
adsamcik Mar 13, 2018
1259227
Refactoring
adsamcik Mar 13, 2018
c176eb2
Updated dependencies
adsamcik Mar 31, 2018
4825192
Increased max number of requests per session
adsamcik Mar 31, 2018
8558c8e
Updated dependencies
adsamcik Mar 31, 2018
ccdc5bc
Add failing test
adsamcik Mar 31, 2018
1f3017f
Add NewItemInQueue event
adsamcik Mar 31, 2018
80dccd9
Enabled expiration
adsamcik Mar 31, 2018
c647679
Updated dependencies
adsamcik Apr 30, 2018
0ba379a
Updated to RavenDB 4.0.5 and .Net Core 2.1
adsamcik Jun 23, 2018
c725ebe
Updated dependencies
adsamcik Jan 21, 2019
da7bc86
Merge branch 'master' into adsamcik/master
Echarnus Jun 7, 2019
32dc6b6
Removed references to ApiKey and ConnectionString; Possibility for ce…
Echarnus Jun 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Hangfire.Raven.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{8CF2D2F6-BEFE-47FE-B141-0017FC6F97D8}"
ProjectSection(SolutionItems) = preProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<Version>3.2.0</Version>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<FileVersion>3.2.0.0</FileVersion>
Expand All @@ -16,15 +16,14 @@
<PackageTags>Hangfire;AspNet;MVC;OWIN;RavenDB;Long-Running;Background;Fire-And-Forget;Delayed;Recurring;Tasks;Jobs;Scheduler;Threading;Queues</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/CadyIO/hangfire-ravendb</RepositoryUrl>
<StartupObject>Hangfire.Raven.Samples.AspNetCore.Program</StartupObject>
<ApplicationIcon />
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.17" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.21" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
Expand Down
68 changes: 44 additions & 24 deletions samples/Hangfire.Raven.Samples.AspNetCore/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Hangfire.Raven.Storage;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace Hangfire.Raven.Samples.AspNetCore
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
namespace Hangfire.Raven.Samples.AspNetCore {
public class Startup {
public Startup(IHostingEnvironment env) {
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
Expand All @@ -23,8 +22,7 @@ public Startup(IHostingEnvironment env)
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
public void ConfigureServices(IServiceCollection services) {
// Add framework services.
services.AddMvc();

Expand All @@ -36,37 +34,45 @@ public void ConfigureServices(IServiceCollection services)
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();

if (env.IsDevelopment())
{
if (env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
} else {
app.UseExceptionHandler("/Home/Error");
}

app.UseStaticFiles();

// Add Hangfire Server and Dashboard support
app.UseHangfireServer();
app.UseHangfireServer(new BackgroundJobServerOptions() { Queues = new[] { "default", "testing" } });
app.UseHangfireDashboard();

// Run once
BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));

BackgroundJob.Enqueue(() => Test());
BackgroundJob.Enqueue(() => QueueTest());

BackgroundJob.Schedule(() => System.Console.WriteLine("Scheduled Job: Hello, I am delayed world!"), new System.TimeSpan(0, 1, 0));

BackgroundJob.Enqueue(() => FailingTest());

// Run every minute
RecurringJob.AddOrUpdate(() => Test(), Cron.Minutely);
RecurringJob.AddOrUpdate(() => CronTest(), Cron.Minutely);


Task.Delay(1000).ContinueWith((task) => {
for (int i = 0; i < 50; i++)
BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello stressed world!"));

app.UseMvc(routes =>
{
for (int i = 0; i < 100; i++)
BackgroundJob.Enqueue(() => WorkerCountTest());
});

app.UseMvc(routes => {
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
Expand All @@ -75,11 +81,25 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF

public static int x = 0;

[AutomaticRetry(Attempts = 2, LogEvents = true, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
public static void Test()
{
[AutomaticRetry(Attempts = 2, LogEvents = true, OnAttemptsExceeded = AttemptsExceededAction.Fail)]
public static void CronTest() {
Debug.WriteLine($"{x++} Cron Job: Hello, world!");
//throw new ArgumentException("fail");
}

[Queue("testing")]
public static void QueueTest() {
Debug.WriteLine($"{x++} Queue test Job: Hello, world!");
}

[Queue("testing")]
public static void FailingTest() {
Debug.WriteLine($"{x++} Requeue test!");
throw new System.Exception();
}


public static void WorkerCountTest() {
Thread.Sleep(5000);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
}
},
"ConnectionStrings": {
"RavenDebug": "URL=http://localhost:9090;Database=HangfireAspNetCore",
"RavenDebugUrl": "http://localhost:9090",
"RavenDebug": "URL=http://localhost:8080;Database=HangfireAspNetCore",
"RavenDebugUrl": "http://localhost:8080",
"RavenDebugDatabase": "HangfireAspNetCore"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputType>exe</OutputType>
<OutputType>Exe</OutputType>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -22,25 +22,18 @@
<RepositoryUrl>https://github.com/CadyIO/hangfire-ravendb</RepositoryUrl>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
<StartupObject />
<StartupObject></StartupObject>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<None Remove="app.config" />
</ItemGroup>

<ItemGroup>
<Content Include="app.config" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\..\src\Hangfire.Raven\Hangfire.Raven.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Hangfire.Core" Version="1.6.17" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="RavenDB.Client" Version="3.5.4" />
<PackageReference Include="Hangfire.Core" Version="1.6.21" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="RavenDB.Client" Version="4.1.3" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions samples/Hangfire.Raven.Samples.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public static void Main()
{
try {
// you can use Raven Storage and specify the connection string name
GlobalConfiguration.Configuration
.UseColouredConsoleLogProvider()
.UseRavenStorage("RavenDebug");

// you can use Raven Storage and specify the connection string and database name
//GlobalConfiguration.Configuration
// .UseColouredConsoleLogProvider()
// .UseRavenStorage("http://localhost:9090", "HangfireConsole");
// .UseRavenStorage("RavenDebug");

// you can use Raven Storage and specify the connection string and database name
GlobalConfiguration.Configuration
.UseColouredConsoleLogProvider()
.UseRavenStorage("http://localhost:8080", "HangfireConsole");

// you can use Raven Embedded Storage which runs in memory!
//GlobalConfiguration.Configuration
Expand Down
Loading