New storage provider

composite-c1
Tags: #<Tag:0x00007f69fbc7dd48>

#1

Just wanted to let you all know that i’ve today published the code for a new Storage Provider that i’ve been working on for a while.

The Provider is built for a system called Composite C1 (http://www.composite.net/) which is a CMS with its abstraction over any linq-compatible datastorage. Out of the box it supports simple Xml files or native MS SQL.

I’ve built this provider to be able to ship and use Hangfire on all Composite C1 solutions without having to worry about whether the installation uses xml files or sql as underlying storage.

Get the source for the provider here https://bitbucket.org/actoas/hangfire.compositec1. Its as easy to use as calling .UseCompositeC1Storage() on your Hangfire config.

No NuGet package have been released yet but expect to see it on nuget.org shortly.


#2

NuGet package released here https://www.nuget.org/packages/Hangfire.CompositeC1


#3

Yay! Can you update its link here?


#4

Hi
I’m trying to use the ScheduledTasks from the CompositeC1Contrib.ScheduledTasks project and is having some problems with the configuration of ScheduledTasks. I managed to the ScheduledTasks installed on my test C1 site but I’m getting the following error when tryin access the ScheduledTasks module from the C1 console: “JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.” It looks like the ScheduledTasks module is using the Hangfire storage and hangfire features. Is there any where I can find some documentation on configuring and using Hangfire on Composite?


#5

The CompositeC1Contrib.ScheduledTasks uses the Owin-style initialization/configuration, which means you need to call UseCompositeC1ContribScheduledTasks() on your IAppBuilder instance, before being able to use the component.

Internally it will configure HangFire in a default configuration, but you’re free to manually configure HangFire as well.

See https://bitbucket.org/burningice/compositec1contrib/src/e2f9b0caef3a1bfda4c1d7e03fb41717079ac626/ScheduledTasks/OwinExtensions.cs?at=default for how the UseCompositeC1ContribScheduledTasks method works.


#6

Thank You very much for the reply.

I have found many ref. to the Contrib project on http://compositec1contrib.codeplex.com/ but it seems that the project is no longer availible there. I was hoping to find some more info on the ScheduledTasks and Owin configuration.

I have found some example on using the Qwin configuration, plugging into the ApplicationStartup path from Composite. I tried to add a Configuration methode to see if there where any Owin AppBuilder availible there but the code was not called. So I’m having a hard time figuring out how to get Composite triggering the Owin configuration in the ScheduledTasks modul. Do You know of any ressources where I can learn more about the Composite C1 Contrib code and examples. I’m trying to learn more for an upcomming project, using Composite.


#7

Owin is a standard component, nothing Hangfire, Composite C1 or C1Contrib specific about that. The easiest in a asp.net website setup, like Composite C1, is to install the https://www.nuget.org/packages/Microsoft.Owin.Host.SystemWeb NuGet package which will detect your Owin Startup Class.


#8

Thank You for the reply.

I guess I expected Composite C1 to have the Owin Host included. I think I need to work a bit more on my Composite C1 skills and knowlegde, to learn how to include my own application to C1.


#9

I can successfully configure Hangfire and enqueue a job, however the task won’t fire. I verify the job is created, there are xml records in datastore.

What would be the problem here? Why jobs won’t fire?

MyAppStartup.cs

using Composite.Core.Application;
using Hangfire.CompositeC1;

[ApplicationStartup]
public class MyAppStartupHandler
{
public static void OnInitialized()
{
Hangfire.GlobalConfiguration.Configuration.UseCompositeC1Storage();
}
}

MyCronJob.cs

using CompositeC1Contrib.ScheduledTasks.Configuration;
using Hangfire;

public static class CronJobs
{
public static void Test()
{
Hangfire.BackgroundJob.Enqueue(() => MyTestApp.Utils.Debug.Break() );
}
}


#10

@Nime Have you looked on the Hangfire dashboard to see if your tasks is queued there? If so, its a Hangfire related issue and not storage.


#11

Hi,
I am trying to use compositeC1 package.But it is not working on my machine.
Application throws an error while executing
a method “Hangfire.GlobalConfiguration.Configuration.UseCompositeC1Storage()”. in startup class.
The error is,
The type initializer for ‘Composite.Core.ResourceSystem.StringResourceSystemFacade’ threw an exception.