{"action":"created","issue":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/4284","repository_url":"https://api.github.com/repos/Particular/NServiceBus","labels_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4284/labels{/name}","comments_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4284/comments","events_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4284/events","html_url":"https://github.com/Particular/NServiceBus/pull/4284","id":188258113,"number":4284,"title":"[Spike] Expose feature components via properties","user":{"login":"timbussmann","id":3524870,"avatar_url":"https://avatars.githubusercontent.com/u/3524870?v=3","gravatar_id":"","url":"https://api.github.com/users/timbussmann","html_url":"https://github.com/timbussmann","followers_url":"https://api.github.com/users/timbussmann/followers","following_url":"https://api.github.com/users/timbussmann/following{/other_user}","gists_url":"https://api.github.com/users/timbussmann/gists{/gist_id}","starred_url":"https://api.github.com/users/timbussmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbussmann/subscriptions","organizations_url":"https://api.github.com/users/timbussmann/orgs","repos_url":"https://api.github.com/users/timbussmann/repos","events_url":"https://api.github.com/users/timbussmann/events{/privacy}","received_events_url":"https://api.github.com/users/timbussmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-09T14:18:40Z","updated_at":"2016-11-11T08:55:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Particular/NServiceBus/pulls/4284","html_url":"https://github.com/Particular/NServiceBus/pull/4284","diff_url":"https://github.com/Particular/NServiceBus/pull/4284.diff","patch_url":"https://github.com/Particular/NServiceBus/pull/4284.patch"},"body":"Instead of exposing components setup by a feature via the context bag, features could expose these as properties which makes the dependencies more explicit and reduces the usage of the context bag.\r\n\r\nWhen using a component from a feature, it's easy to identify this as a dependency and add the required `DependsOn` on the feature to ensure proper setup sequence.\r\n\r\nDownsides:\r\nrequires all features which expose publicly available components (e.g. `Publishers` `RoutingTable` etc.) to be public in order to retrieve them and to define the dependency. The risk is, that those feature can also be passed to `DisableFeature`. But also, this seems to be something we could detect (e.g. by having a `CoreFeature` base class which can't be disabled by the user).\r\ncomponents currently exposed and accessible via settings (\"advanced routing api\") is only configurable via a feature. I don't really see this as a downside as we haven't been able to come up with a proper \"advanced API\". Requiring a feature doesn't seem to be that bad in this case as it again, it requires an explicit statement of dependencies.\r\n\r\n@Particular/nservicebus-maintainers thoughts?"},"comment":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/comments/259911164","html_url":"https://github.com/Particular/NServiceBus/pull/4284#issuecomment-259911164","issue_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4284","id":259911164,"user":{"login":"timbussmann","id":3524870,"avatar_url":"https://avatars.githubusercontent.com/u/3524870?v=3","gravatar_id":"","url":"https://api.github.com/users/timbussmann","html_url":"https://github.com/timbussmann","followers_url":"https://api.github.com/users/timbussmann/followers","following_url":"https://api.github.com/users/timbussmann/following{/other_user}","gists_url":"https://api.github.com/users/timbussmann/gists{/gist_id}","starred_url":"https://api.github.com/users/timbussmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbussmann/subscriptions","organizations_url":"https://api.github.com/users/timbussmann/orgs","repos_url":"https://api.github.com/users/timbussmann/repos","events_url":"https://api.github.com/users/timbussmann/events{/privacy}","received_events_url":"https://api.github.com/users/timbussmann/received_events","type":"User","site_admin":false},"created_at":"2016-11-11T08:55:40Z","updated_at":"2016-11-11T08:55:40Z","body":"not sure I like all these \"factories\".\r\n\r\nHas a conversation with @andreasohlund and he also mentioned some concerns about the fact that making a feature public allows to disable it which shouldn't happen with most of the core feature.\r\n\r\nI think instead we should deprecate the `DisableFeature` API instead.\r\n\r\nAndreas also thought about providing a dedicated \"service\"/dto/holder/whatever from a feature which would be the API used by other features. There may be alternatives instead of using the context bags, e.g.:\r\n\r\n```\r\nclass FeatureDependingOnRouting: Feature, IDependOn<RoutingFeature>\r\n{\r\n\r\n  FeatureDependingOnRouting()\r\n  {\r\n\r\n  }\r\n\r\n  InitalizeDependency(RoutingFeature routingFeature)\r\n  {\r\n       someService = routingFeature.SomeService;\r\n  }  \r\n\r\n  Setup(context)\r\n  {\r\n      //use someService\r\n  }\r\n\r\n  SomeService someService;\r\n}\r\n```\r\n\r\ninstead of  IDependOn<RoutingFeature>, you could of course also depend on something else than a feature itself. But from my point of view, I think removing the Disable API has the same outcome as more fancy and harder to resolve dependencies between features and their exposed services/components. I call yagni on that. Keep it simple. With the mentioned approach we would be able to\r\n* remove most internal DI usage with more explicit dependencies\r\n* remove most usages of contextbag between features\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"timbussmann"}}