{"action":"created","comment":{"url":"https://api.github.com/repos/Particular/docs.particular.net/pulls/comments/63641547","id":63641547,"diff_hunk":"@@ -0,0 +1,84 @@\n+---\n+title: Moving away from `IBus` in NServiceBus Version 6\n+summary: Describes how to send messages without the IBus\n+---\n+\n+Starting with Versions 6 and above, the `IBus` interface has been deprecated.\n+\n+The `IBus` interface was one of the key interfaces when using previous versions of NServiceBus. It provided access to many of the important operations like sending messages, subscribing to events, and manipulating headers. The `IBus` interface was injected into the container using dependency injection and was accessible in all the message handlers and other injected components in the container as well. \n+\n+There are several scenarios when using IBus:\n+\n+## During Endpoint Creation\n+\n+In previous versions of NServiceBus to start a new instance of an endpoint, either the `Bus` static class or the `IStartableBus` interface was used. In Version 6 these two concepts have been replaced. More information can be found in the [hosting](/nservicebus/hosting/) section of the documentation.\n+\n+`BusConfiguration` has been deprecated. Use `EndpointConfiguration` instead to configure and start the endpoint. \n+\n+Instead of the `Bus` class, a new class called `Endpoint` helps to start the endpoint.\n+\n+snippet: 5to6-endpoint-start-stop\n+\n+Starting the endpoint, provides access to `IEndpointInstance` which can be used to send messages during endpoint start up instead.\n+\n+## Sending messages outside message handlers\n+\n+A common use of `IBus` is to invoke bus operations outside of message handlers, such as sending a message from an ASP.NET request or from a UI input. Instead of an `IBus` the `IEndpointInstance` offers all available bus operations outside the message processing pipeline. For example:\n+\n+If the endpoint is hosted using NServiceBus.Host, use the [IWantToRunWhenEndpointStartsAndStops interface](/nservicebus/upgrades/host-6to7.md) as outlined in the NServiceBus.Host documentation.\n+\n+## Sending messages inside message handlers\n+\n+The public `IBus` injection property in message handlers can now be safely deleted.\n+\n+The message handlers now includes an additional `IMessageHandlerContext` parameter, which provides the methods that used to be called from `IBus`. Use the `IMessageHandlerContext` to send and publish messages from within the message handler. \n+\n+snippet:5to6-bus-send-publish\n+\n+\n+## Accessing the CurrentMessageContext\n+\n+Previously it was possible to access message parameters such `MessageId`, `ReplyToAddress` and the message headers via the `CurrentMessageContext` property on the `IBus` interface. These message properties are now available directly via the message handler context parameter.\n+\n+snippet: 5to6-messagecontext\n+\n+\n+## Dependency Injection\n+\n+In previous versions of NServiceBus the `IBus` interface was automatically registered in the IoC container. In Version 6, the new context aware interfaces namely the `IEndpointInstance`, `IMessageSession` or `IMessageHandlerContext` will not be automatically registered in the IoC container. ","path":"nservicebus/upgrades/5to6-moving-away-from-ibus.md","position":48,"original_position":48,"commit_id":"326e31276e7eb2539be4f7dea8c9adc104f0393d","original_commit_id":"e3427fbb65c434af497a8bd30f4925e18e958d1c","user":{"login":"indualagarsamy","id":854553,"avatar_url":"https://avatars.githubusercontent.com/u/854553?v=3","gravatar_id":"","url":"https://api.github.com/users/indualagarsamy","html_url":"https://github.com/indualagarsamy","followers_url":"https://api.github.com/users/indualagarsamy/followers","following_url":"https://api.github.com/users/indualagarsamy/following{/other_user}","gists_url":"https://api.github.com/users/indualagarsamy/gists{/gist_id}","starred_url":"https://api.github.com/users/indualagarsamy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indualagarsamy/subscriptions","organizations_url":"https://api.github.com/users/indualagarsamy/orgs","repos_url":"https://api.github.com/users/indualagarsamy/repos","events_url":"https://api.github.com/users/indualagarsamy/events{/privacy}","received_events_url":"https://api.github.com/users/indualagarsamy/received_events","type":"User","site_admin":false},"body":"ok","created_at":"2016-05-18T03:49:23Z","updated_at":"2016-05-18T03:49:23Z","html_url":"https://github.com/Particular/docs.particular.net/pull/1535#discussion_r63641547","pull_request_url":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535","_links":{"self":{"href":"https://api.github.com/repos/Particular/docs.particular.net/pulls/comments/63641547"},"html":{"href":"https://github.com/Particular/docs.particular.net/pull/1535#discussion_r63641547"},"pull_request":{"href":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535"}}},"pull_request":{"url":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535","id":70462323,"html_url":"https://github.com/Particular/docs.particular.net/pull/1535","diff_url":"https://github.com/Particular/docs.particular.net/pull/1535.diff","patch_url":"https://github.com/Particular/docs.particular.net/pull/1535.patch","issue_url":"https://api.github.com/repos/Particular/docs.particular.net/issues/1535","number":1535,"state":"open","locked":false,"title":"WIP - Moving away from IBus","user":{"login":"indualagarsamy","id":854553,"avatar_url":"https://avatars.githubusercontent.com/u/854553?v=3","gravatar_id":"","url":"https://api.github.com/users/indualagarsamy","html_url":"https://github.com/indualagarsamy","followers_url":"https://api.github.com/users/indualagarsamy/followers","following_url":"https://api.github.com/users/indualagarsamy/following{/other_user}","gists_url":"https://api.github.com/users/indualagarsamy/gists{/gist_id}","starred_url":"https://api.github.com/users/indualagarsamy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indualagarsamy/subscriptions","organizations_url":"https://api.github.com/users/indualagarsamy/orgs","repos_url":"https://api.github.com/users/indualagarsamy/repos","events_url":"https://api.github.com/users/indualagarsamy/events{/privacy}","received_events_url":"https://api.github.com/users/indualagarsamy/received_events","type":"User","site_admin":false},"body":"Relates to: https://github.com/Particular/docs.particular.net/issues/1327","created_at":"2016-05-18T02:58:19Z","updated_at":"2016-05-18T03:49:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c0f64388d937196d89097f1872d9eb4437d19a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535/commits","review_comments_url":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535/comments","review_comment_url":"https://api.github.com/repos/Particular/docs.particular.net/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Particular/docs.particular.net/issues/1535/comments","statuses_url":"https://api.github.com/repos/Particular/docs.particular.net/statuses/326e31276e7eb2539be4f7dea8c9adc104f0393d","head":{"label":"Particular:moving-away-from-ibus","ref":"moving-away-from-ibus","sha":"326e31276e7eb2539be4f7dea8c9adc104f0393d","user":{"login":"Particular","id":5038441,"avatar_url":"https://avatars.githubusercontent.com/u/5038441?v=3","gravatar_id":"","url":"https://api.github.com/users/Particular","html_url":"https://github.com/Particular","followers_url":"https://api.github.com/users/Particular/followers","following_url":"https://api.github.com/users/Particular/following{/other_user}","gists_url":"https://api.github.com/users/Particular/gists{/gist_id}","starred_url":"https://api.github.com/users/Particular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Particular/subscriptions","organizations_url":"https://api.github.com/users/Particular/orgs","repos_url":"https://api.github.com/users/Particular/repos","events_url":"https://api.github.com/users/Particular/events{/privacy}","received_events_url":"https://api.github.com/users/Particular/received_events","type":"Organization","site_admin":false},"repo":{"id":11727301,"name":"docs.particular.net","full_name":"Particular/docs.particular.net","owner":{"login":"Particular","id":5038441,"avatar_url":"https://avatars.githubusercontent.com/u/5038441?v=3","gravatar_id":"","url":"https://api.github.com/users/Particular","html_url":"https://github.com/Particular","followers_url":"https://api.github.com/users/Particular/followers","following_url":"https://api.github.com/users/Particular/following{/other_user}","gists_url":"https://api.github.com/users/Particular/gists{/gist_id}","starred_url":"https://api.github.com/users/Particular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Particular/subscriptions","organizations_url":"https://api.github.com/users/Particular/orgs","repos_url":"https://api.github.com/users/Particular/repos","events_url":"https://api.github.com/users/Particular/events{/privacy}","received_events_url":"https://api.github.com/users/Particular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Particular/docs.particular.net","description":"Contains all the content for the Particular documentation site","fork":false,"url":"https://api.github.com/repos/Particular/docs.particular.net","forks_url":"https://api.github.com/repos/Particular/docs.particular.net/forks","keys_url":"https://api.github.com/repos/Particular/docs.particular.net/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Particular/docs.particular.net/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Particular/docs.particular.net/teams","hooks_url":"https://api.github.com/repos/Particular/docs.particular.net/hooks","issue_events_url":"https://api.github.com/repos/Particular/docs.particular.net/issues/events{/number}","events_url":"https://api.github.com/repos/Particular/docs.particular.net/events","assignees_url":"https://api.github.com/repos/Particular/docs.particular.net/assignees{/user}","branches_url":"https://api.github.com/repos/Particular/docs.particular.net/branches{/branch}","tags_url":"https://api.github.com/repos/Particular/docs.particular.net/tags","blobs_url":"https://api.github.com/repos/Particular/docs.particular.net/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Particular/docs.particular.net/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Particular/docs.particular.net/git/refs{/sha}","trees_url":"https://api.github.com/repos/Particular/docs.particular.net/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Particular/docs.particular.net/statuses/{sha}","languages_url":"https://api.github.com/repos/Particular/docs.particular.net/languages","stargazers_url":"https://api.github.com/repos/Particular/docs.particular.net/stargazers","contributors_url":"https://api.github.com/repos/Particular/docs.particular.net/contributors","subscribers_url":"https://api.github.com/repos/Particular/docs.particular.net/subscribers","subscription_url":"https://api.github.com/repos/Particular/docs.particular.net/subscription","commits_url":"https://api.github.com/repos/Particular/docs.particular.net/commits{/sha}","git_commits_url":"https://api.github.com/repos/Particular/docs.particular.net/git/commits{/sha}","comments_url":"https://api.github.com/repos/Particular/docs.particular.net/comments{/number}","issue_comment_url":"https://api.github.com/repos/Particular/docs.particular.net/issues/comments{/number}","contents_url":"https://api.github.com/repos/Particular/docs.particular.net/contents/{+path}","compare_url":"https://api.github.com/repos/Particular/docs.particular.net/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Particular/docs.particular.net/merges","archive_url":"https://api.github.com/repos/Particular/docs.particular.net/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Particular/docs.particular.net/downloads","issues_url":"https://api.github.com/repos/Particular/docs.particular.net/issues{/number}","pulls_url":"https://api.github.com/repos/Particular/docs.particular.net/pulls{/number}","milestones_url":"https://api.github.com/repos/Particular/docs.particular.net/milestones{/number}","notifications_url":"https://api.github.com/repos/Particular/docs.particular.net/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Particular/docs.particular.net/labels{/name}","releases_url":"https://api.github.com/repos/Particular/docs.particular.net/releases{/id}","deployments_url":"https://api.github.com/repos/Particular/docs.particular.net/deployments","created_at":"2013-07-28T23:18:15Z","updated_at":"2016-05-11T02:56:54Z","pushed_at":"2016-05-18T03:38:45Z","git_url":"git://github.com/Particular/docs.particular.net.git","ssh_url":"git@github.com:Particular/docs.particular.net.git","clone_url":"https://github.com/Particular/docs.particular.net.git","svn_url":"https://github.com/Particular/docs.particular.net","homepage":"http://docs.particular.net","size":51478,"stargazers_count":24,"watchers_count":24,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":126,"mirror_url":null,"open_issues_count":121,"forks":126,"open_issues":121,"watchers":24,"default_branch":"master"}},"base":{"label":"Particular:master","ref":"master","sha":"18d4aeaf03b92bb281d75a338f91c4b3449ea1c5","user":{"login":"Particular","id":5038441,"avatar_url":"https://avatars.githubusercontent.com/u/5038441?v=3","gravatar_id":"","url":"https://api.github.com/users/Particular","html_url":"https://github.com/Particular","followers_url":"https://api.github.com/users/Particular/followers","following_url":"https://api.github.com/users/Particular/following{/other_user}","gists_url":"https://api.github.com/users/Particular/gists{/gist_id}","starred_url":"https://api.github.com/users/Particular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Particular/subscriptions","organizations_url":"https://api.github.com/users/Particular/orgs","repos_url":"https://api.github.com/users/Particular/repos","events_url":"https://api.github.com/users/Particular/events{/privacy}","received_events_url":"https://api.github.com/users/Particular/received_events","type":"Organization","site_admin":false},"repo":{"id":11727301,"name":"docs.particular.net","full_name":"Particular/docs.particular.net","owner":{"login":"Particular","id":5038441,"avatar_url":"https://avatars.githubusercontent.com/u/5038441?v=3","gravatar_id":"","url":"https://api.github.com/users/Particular","html_url":"https://github.com/Particular","followers_url":"https://api.github.com/users/Particular/followers","following_url":"https://api.github.com/users/Particular/following{/other_user}","gists_url":"https://api.github.com/users/Particular/gists{/gist_id}","starred_url":"https://api.github.com/users/Particular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Particular/subscriptions","organizations_url":"https://api.github.com/users/Particular/orgs","repos_url":"https://api.github.com/users/Particular/repos","events_url":"https://api.github.com/users/Particular/events{/privacy}","received_events_url":"https://api.github.com/users/Particular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Particular/docs.particular.net","description":"Contains all the content for the Particular documentation site","fork":false,"url":"https://api.github.com/repos/Particular/docs.particular.net","forks_url":"https://api.github.com/repos/Particular/docs.particular.net/forks","keys_url":"https://api.github.com/repos/Particular/docs.particular.net/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Particular/docs.particular.net/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Particular/docs.particular.net/teams","hooks_url":"https://api.github.com/repos/Particular/docs.particular.net/hooks","issue_events_url":"https://api.github.com/repos/Particular/docs.particular.net/issues/events{/number}","events_url":"https://api.github.com/repos/Particular/docs.particular.net/events","assignees_url":"https://api.github.com/repos/Particular/docs.particular.net/assignees{/user}","branches_url":"https://api.github.com/repos/Particular/docs.particular.net/branches{/branch}","tags_url":"https://api.github.com/repos/Particular/docs.particular.net/tags","blobs_url":"https://api.github.com/repos/Particular/docs.particular.net/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Particular/docs.particular.net/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Particular/docs.particular.net/git/refs{/sha}","trees_url":"https://api.github.com/repos/Particular/docs.particular.net/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Particular/docs.particular.net/statuses/{sha}","languages_url":"https://api.github.com/repos/Particular/docs.particular.net/languages","stargazers_url":"https://api.github.com/repos/Particular/docs.particular.net/stargazers","contributors_url":"https://api.github.com/repos/Particular/docs.particular.net/contributors","subscribers_url":"https://api.github.com/repos/Particular/docs.particular.net/subscribers","subscription_url":"https://api.github.com/repos/Particular/docs.particular.net/subscription","commits_url":"https://api.github.com/repos/Particular/docs.particular.net/commits{/sha}","git_commits_url":"https://api.github.com/repos/Particular/docs.particular.net/git/commits{/sha}","comments_url":"https://api.github.com/repos/Particular/docs.particular.net/comments{/number}","issue_comment_url":"https://api.github.com/repos/Particular/docs.particular.net/issues/comments{/number}","contents_url":"https://api.github.com/repos/Particular/docs.particular.net/contents/{+path}","compare_url":"https://api.github.com/repos/Particular/docs.particular.net/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Particular/docs.particular.net/merges","archive_url":"https://api.github.com/repos/Particular/docs.particular.net/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Particular/docs.particular.net/downloads","issues_url":"https://api.github.com/repos/Particular/docs.particular.net/issues{/number}","pulls_url":"https://api.github.com/repos/Particular/docs.particular.net/pulls{/number}","milestones_url":"https://api.github.com/repos/Particular/docs.particular.net/milestones{/number}","notifications_url":"https://api.github.com/repos/Particular/docs.particular.net/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Particular/docs.particular.net/labels{/name}","releases_url":"https://api.github.com/repos/Particular/docs.particular.net/releases{/id}","deployments_url":"https://api.github.com/repos/Particular/docs.particular.net/deployments","created_at":"2013-07-28T23:18:15Z","updated_at":"2016-05-11T02:56:54Z","pushed_at":"2016-05-18T03:38:45Z","git_url":"git://github.com/Particular/docs.particular.net.git","ssh_url":"git@github.com:Particular/docs.particular.net.git","clone_url":"https://github.com/Particular/docs.particular.net.git","svn_url":"https://github.com/Particular/docs.particular.net","homepage":"http://docs.particular.net","size":51478,"stargazers_count":24,"watchers_count":24,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":126,"mirror_url":null,"open_issues_count":121,"forks":126,"open_issues":121,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535"},"html":{"href":"https://github.com/Particular/docs.particular.net/pull/1535"},"issue":{"href":"https://api.github.com/repos/Particular/docs.particular.net/issues/1535"},"comments":{"href":"https://api.github.com/repos/Particular/docs.particular.net/issues/1535/comments"},"review_comments":{"href":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535/comments"},"review_comment":{"href":"https://api.github.com/repos/Particular/docs.particular.net/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Particular/docs.particular.net/pulls/1535/commits"},"statuses":{"href":"https://api.github.com/repos/Particular/docs.particular.net/statuses/326e31276e7eb2539be4f7dea8c9adc104f0393d"}}}}