{"action":"created","issue":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/2914","repository_url":"https://api.github.com/repos/Particular/NServiceBus","labels_url":"https://api.github.com/repos/Particular/NServiceBus/issues/2914/labels{/name}","comments_url":"https://api.github.com/repos/Particular/NServiceBus/issues/2914/comments","events_url":"https://api.github.com/repos/Particular/NServiceBus/issues/2914/events","html_url":"https://github.com/Particular/NServiceBus/issues/2914","id":107590185,"number":2914,"title":"MutateIncomingMessageContext cancel message processing","user":{"login":"marinkobabic","id":3265080,"avatar_url":"https://avatars.githubusercontent.com/u/3265080?v=3","gravatar_id":"","url":"https://api.github.com/users/marinkobabic","html_url":"https://github.com/marinkobabic","followers_url":"https://api.github.com/users/marinkobabic/followers","following_url":"https://api.github.com/users/marinkobabic/following{/other_user}","gists_url":"https://api.github.com/users/marinkobabic/gists{/gist_id}","starred_url":"https://api.github.com/users/marinkobabic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marinkobabic/subscriptions","organizations_url":"https://api.github.com/users/marinkobabic/orgs","repos_url":"https://api.github.com/users/marinkobabic/repos","events_url":"https://api.github.com/users/marinkobabic/events{/privacy}","received_events_url":"https://api.github.com/users/marinkobabic/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Particular/NServiceBus/labels/Type:%20Discussion","name":"Type: Discussion","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-21T20:17:22Z","updated_at":"2016-04-11T09:38:36Z","closed_at":"2016-04-11T09:38:36Z","body":"Inside of the devevop branch I don't see a way to cancel the processing of the message inside of a IMutateIncomingMessages like this is privided by HandlingStageBehavior.Context.DoNotInvokeAnyMoreHandlers(). \r\n\r\nContextualBus contains the following method, but this expects that the context is HandlingStageBehavior.Context:\r\n\r\n```c#\r\npublic void DoNotContinueDispatchingCurrentMessageToHandlers()\r\n{\r\n  ((HandlingStageBehavior.Context)incomingContext).DoNotInvokeAnyMoreHandlers();\r\n}\r\n```\r\n\r\n* The idea is to validate the message and notify whatever service about validation result and to cancel the processing of the message if the message validation result is invalid.\r\n\r\n* Another scenario is to implement custom authorization and to cancel the whole process if the authorization data is invalid.\r\n\r\nActually the only way I see is to tell the bus to use a fix first message handler and to perform the job inside of this handler."},"comment":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/comments/208255194","html_url":"https://github.com/Particular/NServiceBus/issues/2914#issuecomment-208255194","issue_url":"https://api.github.com/repos/Particular/NServiceBus/issues/2914","id":208255194,"user":{"login":"danielmarbach","id":174258,"avatar_url":"https://avatars.githubusercontent.com/u/174258?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmarbach","html_url":"https://github.com/danielmarbach","followers_url":"https://api.github.com/users/danielmarbach/followers","following_url":"https://api.github.com/users/danielmarbach/following{/other_user}","gists_url":"https://api.github.com/users/danielmarbach/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmarbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmarbach/subscriptions","organizations_url":"https://api.github.com/users/danielmarbach/orgs","repos_url":"https://api.github.com/users/danielmarbach/repos","events_url":"https://api.github.com/users/danielmarbach/events{/privacy}","received_events_url":"https://api.github.com/users/danielmarbach/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T09:38:36Z","updated_at":"2016-04-11T09:38:36Z","body":"I opened up a documentation issue. Closing this one"}}