-
Notifications
You must be signed in to change notification settings - Fork 456
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
added start on call and priority for "startables" #37
Conversation
Hey, It's functionality I was thinking about myself. I had a slightly different API in mind though. var flag = new StartFlag();
container.AddFacility<StartableFacility>(f => f.DeferredStart(flag))
container.Install(FromAssembly.This());
// do some extra work
flag.Signal(); as for the priority... this could be solved by having multiple named tokens, so the components that need to be started first are started when the first flag is signalled, and the rest when the default flag is signalled... |
Who should be responsible for calling flag.Signal()? With multiple "named tokens", in composition root one would have: firstsFlag.Signal(); And how would you say which flag starts which startable? |
whoever manages the
I'm thinking you'd only have one flag.Signal("first-group");
flag.Signal("second-group");
flag.Signal(); // the default non-named group. On the registration side of things, I imagine you'd mark the component with the start group name somehow. Perhaps like: container.Register(Component.For<SomeClass>()
.StartInGroup("first-group")
); What do you think? |
I like the idea, that you solve the problem with both, priority of start and signal to start "startables" with one API. However, with my use case, I don't usually have "groups" of startables but single startable (each group would contain one startable). Now I need to have registration by name in installers and then the chain of hierarchy on other place. Really not sure what I like more. |
The problem with numbers is also refactoring (changing the chain of startables). With group names, It would be definitely easier. |
Can you elaborate on that a bit more? I haven't come across this scenario yet |
When dealing with startables, I have a few concrete services, where one Hopefuly, it's understandable. However, it can also be implemented with
|
Cool, I think we're getting somewhere :) One thing I'm wondering, is if it woundn't be a good idea to split this into two parts. One would be implementing the support for The other one, would be building extension points to allow us to easily support the other, advanced scenario, with multiple groups. The actual implementation of that could be provided via another package. The reasoning for that is, I want Windsor to be slim and provide high impact features out of the box, as well as have simple extension points to allow for less common/more complex scenarios, thus keeping the core small and the basic API simple. |
I was thinking about new "facility" as well. However, I'm still not sure about the final solution. Do you want me to create a new pull request where we will keep desinging and here, keep just the explicit signalling? |
sounds good Krzysztof Kozmic On Friday, 3 January 2014 at 8:05 pm, jfojtl wrote:
|
Hey, How's it going? I'm thinking we might want to do another release perhaps within the next month. It would be nice to have the basic functionality for that in it, as we discussed. Do you think you'll have to time to clean up this pull request so we can merge it? If not that's fine. I'm happy to jump in and implement it myself if you're too busy. |
Hi, Sorry, pretty busy last few months. I'll do it during the weekend. |
Hey, I've got some spare time so I may have a stab at implementing it today, unless you've beaten me to it and have it updated and ready somewhere already :) |
I implemented the functionality as we discussed. Thanks for the feedback. Let me know if you have any comments about the code. |
When using Startable Facility, I need to start Components in order, that's why I added an option for prioritization of them. Components with lowest priority number are started at first.
I also need to say, when to start startable components, since we apply installers from multiple assemblies. Anyway, I am sorry that these two funcitonalities are in one commit but I made it all pretty fast since it was pretty easy to add it.
If the pull request gets merged, I am also ready to update the documentation. Thanks for opinions and much appreciated code review.