cadyio / hangfire-ravendb Goto Github PK
View Code? Open in Web Editor NEWRavenDB job storage for Hangfire
Home Page: https://www.nuget.org/packages/Hangfire.Raven/
RavenDB job storage for Hangfire
Home Page: https://www.nuget.org/packages/Hangfire.Raven/
Doesn't work:
BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));
Works:
BackgroundJob.Enqueue(() => Test());
[AutomaticRetry(Attempts = 2, LogEvents = true, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
public static void Test()
{
Console.WriteLine("Background Job: Hello, world!"));
}
The latest version doesn't appear to be working in ASP.Net applications.
When making a call to BackgroundJob.Enqueue I am getting the following exception:
System.NullReferenceException
Message=Object reference not set to an instance of an object.
Source=Hangfire.Raven
StackTrace:
at Hangfire.Raven.RavenJsonMethodConverter.Read(Type type, Object value, JsonSerializer serializer)
at Hangfire.Raven.RavenJsonConverterBase`1.ReadJson(JsonReader reader, Type type, Object existingValue, JsonSerializer serializer)
at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) in C:\Builds\RavenDB-Stable-3.5\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 1771
at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) in C:\Builds\RavenDB-Stable-3.5\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 900
at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) in C:\Builds\RavenDB-Stable-3.5\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 2005
I believe this is due to Assembly.GetEntryAssembly() returning null on the following line:
https://github.com/cady-io/hangfire-ravendb/blob/c65b8b13143302424763c2d5d76eeed68a2e225c/src/Hangfire.Raven/RavenJsonConverters.cs#L90
The same error would also occur here:
https://github.com/cady-io/hangfire-ravendb/blob/c65b8b13143302424763c2d5d76eeed68a2e225c/src/Hangfire.Raven/RavenJsonConverters.cs#L107
I am unable to configure RavenStorage using a predefined connection string e.g. GlobalConfiguration.Configuration.UseRavenStorage("Hangfire")
, where the connection string is defined like the following in the web.config:
<connectionStrings>
<add name="Hangfire" connectionString="Url = http://localhost:8080;Database=Hangfire" />
</connectionStrings>
It appears that DefaultDatabase is being overwritten with null
on the following line:
https://github.com/cady-io/hangfire-ravendb/blob/master/src/Hangfire.Raven/Repository.cs#L61
I don't believe the DefaultDatabase (or ApiKey) need to set explicitly here as these values are already defined in the connection string itself.
I am trying to use hangfire.ravendb in a .net 4.6 project that also uses RavenDB. This is not possible due to a version conflict with RavenDB client. I am using the net45 version, while this library is using the netstandard1.3 version.
The netstandard1.3 dependency doesn't resolve due to difference in public key token (netstandard1.3's key is null). I've tried to get around this by manually loading the full version assembly using AppDomain.CurrentDomain.AssemblyResolve event but that didn't work either due to implementation differences between the assembly versions.
Could you provide a full framework version or workaround?
How do I configure the connection string for production use with an API Key, the raven instance is located on another server so I'm using the secure API Key.
GlobalConfiguration.Configuration.UseRavenStorage("connection_string", "database_name");
The connection string contains Url at the start which causing the http/https exception. Of course I dropped the URL part but it comes with the api key and database name already.
Options from Raven are:
Connection String: "Url = http://localhost:8080; ApiKey = esting/cheeolfngotns; Database = Testing"
Direct Link: "http://localhost:8080/studio/index.html#api-key=testing/cheeolfngotns"
I've tried all sorts of variations to get it working but it errors with:
System.ObjectDisposedException: The document store has already been disposed and cannot be used
Object name: 'DocumentStore'.
This works fine localhost without the API key
While invoking
services.AddHangfire(c => c.UseRavenStorage(ravenConfig.Url, ravenConfig.Database));
it complains of missing dlls like:
They are missing under package folder.
I'm using Raven.Client v4.1.4, seems like missing dlls are not included anymore neither of these packages.
Hello, I updated with the last version which seems to be supported in asp .net core
This is what I do:
GlobalConfiguration.Configuration.UseRavenStorage(ravenDBHost, "Hangfire");
var client = new BackgroundJobServer();
BackgroundJob.Enqueue(() => Console.WriteLine("Background Job: Hello, world!"));
I am getting an error such as this:
{Raven.Imports.Newtonsoft.Json.JsonSerializationException: Could not read value for property: Job ---> Raven.Imports.Newtonsoft.Json.JsonSerializationException: Could not read value for property:
at System.Reflection.TypeExtensions.GetMethod(Type type, String name)
at Hangfire.Raven.RavenJsonMethodConverter.Read(Type type, Object value, JsonSerializer serializer)
at Hangfire.Raven.RavenJsonConverterBase`1.ReadJson(JsonReader reader, Type type, Object existingValue, JsonSerializer serializer)
at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) in C:\Builds\RavenDB-3.5-RC\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 1769
at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) in C:\Builds\RavenDB-3.5-RC\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 900
at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) in C:\Builds\RavenDB-3.5-RC\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 2005
**Could not convert document RavenJobs/c80515fa-c78f-4f12-a39e-4e5e30ea1060 to entity of type Hangfire.Raven.Entities.RavenJob**
I see that there is new record in the RavenDB
Please assist.
Good afternoon everyone,
I am currently developing a project in .NET Core 2.2 requiring to use Hangfire. As you already understood, we are also using a NoSQL database through RavenDB.
My question for this repository that seems pretty attracting is :
Is this up to date and ready to use with the current version of the following frameworks ?
- Microsoft.AspNetCore v2.2.0 (.NET Core 2.2)
- Hangfire v1.7.6
- Hangfire.AspNetCore v1.7.6
- RavenDB.Client v4.2.2
Cheers guys :D
Is there a specific reason for targetting netcoreapp2.0
instead of netstandard2.0
which, as I understand it, is recommended for libraries?
If not, it would be nice to switch to targetting netstandard2.0
since that is "implemented" in the full .NET Framework from version 4.6.1, enabling the same assembly to be used from both .NET Core and the full framework.
using Hangfire;
using HangFire.Raven.Storage;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(HangfireServer.Startup))]
namespace HangfireServer
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
GlobalConfiguration.Configuration.UseRavenStorage("http://localhost:8080", "hangfire");
app.UseHangfireDashboard();
app.UseHangfireServer();
}
}
}
Any ideas why? A database titled "hangfire" does exist and the ravendb server is running at http://localhost:8080.
The current release 3.5 does not support NetStandard.
Why GlobalConfiguration.Configuration.UseEmbeddedRavenStorage() option is removed since 2.0 version? Is new way exist to configure it? In README this way is stayed. I am confused a little...
This is an issue with Hangfire and will have to wait for a fix from core.
When not using a connection string, the way the DocumentStore
is constructed using the DefaultDatabase
property requires read-access to the System
database. In certain environments (like RavenHQ) that isn't granted โ leading to an exception on start up.
I seems that constructing the URL for a specific database manually, f.ex. https://ravenserver/databases/foo
and not setting DefaultDatabase
avoids this problem.
Are there any drawbacks to this I'm not seeing atm.?
Any attempt to use RecurringJob.RemoveIfExists with throw an object reference not set exception if the job id doesn't exist in the underlying RavenDb storage.
The exception originates in the Hangfire.Raven.RavenWriteOnlyTransaction.RemoveFromSet method.
This behaviour is not consistent with other Hangfire storage implementations, they will remove the job if it exists and won't throw an exception if it doesn't. See the documentation at the following link:
http://docs.hangfire.io/en/latest/background-methods/performing-recurrent-tasks.html
Hello,
When you get a chance could you please publish the latest NuGet package.
Many thanks
Any plans to update this project to AspNet-Core?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.