Comments (8)
Nuget version 1.1.0 released with the new changes!
from hangfire.windsor.
I ended up rewriting this in my own codebase where I have a Windsor Job Activator that works in tandem with a globally installed job filter.
The job filter sees the start of a job, which happens on a specific thread. It tells the job activator of this, which sets up a child Windsor container in a thread local. On the same thread, Hangfire then executes the job and asks the Windsor Job Activator to create its types. The job activator gets the child container from the thread local and does its thing.
When the job is finished, the job filter tells the job activator to dispose of the child container created specifically for the thread.
I got the idea from reading a few different approaches people had taken with other IOC containers and Hangfire. Note that I think Hangfire 1.5+ has some additional IOC hooks which may make some of this no longer required.
I put an extract of my code in a gist
https://gist.github.com/IanYates/29180ce09c41e42b9a7e
Hope it's of some help.
from hangfire.windsor.
@BredStik - could I perhaps create a PR against this repo and, if so, could you then update NuGet?
from hangfire.windsor.
I implemented in other way. Can you check it: https://gist.github.com/IanYates/29180ce09c41e42b9a7e#gistcomment-1677285
Thanks a lot.
from hangfire.windsor.
(referring to your comment on the Gist)
The job activator scope is the new thing introduced in Hangfire 1.5. The old approach still works but the newer approach is probably better. I haven't updated to 1.5 since I didn't want to reverify the correct Windsor behaviour again.
In the code you've posted I don't see any Windsor usage - is it hidden behind the IIocResolver?
The approach seems pretty sound though. Certainly it's less hacky :)
Thanks!
from hangfire.windsor.
IIocResolver is ASP.NET Boilerplate's IOC abstraction. You can use same by sending Windsor Container directly. As I test, it's properly working.
from hangfire.windsor.
I created a new branch specifically to support 1.5 + version of Hangfire. Please feel free to submit a pull request that would use the job activator scope.
from hangfire.windsor.
Thanks to @jeroenvervaeke , this issue is closed! Will update the nuget package soon.
from hangfire.windsor.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hangfire.windsor.