Closed johnsimons closed 10 years ago
Would there be an easy way to switch between "new drop-in profiles" for different builds (ie. Debug,Release,etc) ?
Hi @chrisbednarski, That is a good point, suggestions?
@chrisbednarski btw, this is not a "new drop-in profiles", this is just a discussion to find out if we can improve profiles.
I don't see issues with the way profiles are currently & the way I'm using them.
Crazy idea ... if a separate IConfigureLoggingForProfile<T>
is a problem, maybe add ability to use logging from other, existing profiles, ala how the roles work for transports
interface IHandleProfileAndLogging<T, L> : IHandleProfile<T>, UsingLoggingFromProfile<L>
Or, maybe not :)
Drop-in style of profiles would make it difficult to do more complex logic like IHandleAnyProfile based on combinations or if/else. I suppose you could just either drop in AssemblyA or Assembly B, but this does make deployment a lot more complex when a lot of people are just doing straight robocopy on the build server's bin/Release directory.
But doesn't the same complexity exist with supplying profiles as cmd line args?
On Thursday, August 22, 2013, David Boike wrote:
Drop-in style of profiles would make it difficult to do more complex logic like IHandleAnyProfile based on combinations or if/else. I suppose you could just either drop in AssemblyA or Assembly B, but this does make deployment a lot more complex when a lot of people are just doing straight robocopy on the build server's bin/Release directory.
— Reply to this email directly or view it on GitHubhttps://github.com/Particular/NServiceBus/issues/1463#issuecomment-23044959 .
Regards John Simons NServiceBus
No. I install the endpoint once. Binary swapping makes action required on every deployment.
Your example problem was a from scratch profile. That probably isn't smart to begin with and should be discouraged. In 2.0 I did that because it was nearly impossible to do minor tweaks from a profile that inherited a built in one because things would be double registered. Is that still the case today?
@ducttapeman NSB now in most cases checks, if a component already has been registered before registering it...
That's what I was thinking. In that case it might be better to do a process where you check to see if key things are configured, and in the exception thrown, don't say "Consider implementing IConfigureLogging" but instead check the inheritance chain for the profile and say "Consider overriding a default profile instead."
About a week ago I posted a simple question on the discussion list:
see original here
And the answers started coming :birthday:
Why did I raise this?
Mostly because I see profiles as just code that gets executed if present. What I mean is that profiles can be replaced with drop-in assemblies, and as we know by default NServiceBus will scan all assemblies and execute the code. So we could just have a
LiteProfile.dll
that is added to the bin folder in development, eg:The benefits I see with this approach:
Obviously this solution still has drawbacks
This has actually been fixed in v4 so now, if you execute
NServiceBus.Host.exe MyProfileA MyProfileB MyProfileC
, the profile handlers are executed in order, MyProfileAHandler then MyProfileBHandler and finally MyProfileCHandlerAnnoyances with profiles
If you ever decide to write your own profile, eg:
This code will fail with the following exception:
Why do I also need to implement
IConfigureLoggingForProfile<MyProfileA>
?It feels strange and unnecessary if I'm happy with the defaults.