{"action":"created","issue":{"url":"https://api.github.com/repos/volak/Aggregates.NET/issues/11","repository_url":"https://api.github.com/repos/volak/Aggregates.NET","labels_url":"https://api.github.com/repos/volak/Aggregates.NET/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/volak/Aggregates.NET/issues/11/comments","events_url":"https://api.github.com/repos/volak/Aggregates.NET/issues/11/events","html_url":"https://github.com/volak/Aggregates.NET/issues/11","id":180230566,"number":11,"title":"Support for sending commands from message handlers","user":{"login":"volak","id":1750226,"avatar_url":"https://avatars3.githubusercontent.com/u/1750226?v=4","gravatar_id":"","url":"https://api.github.com/users/volak","html_url":"https://github.com/volak","followers_url":"https://api.github.com/users/volak/followers","following_url":"https://api.github.com/users/volak/following{/other_user}","gists_url":"https://api.github.com/users/volak/gists{/gist_id}","starred_url":"https://api.github.com/users/volak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volak/subscriptions","organizations_url":"https://api.github.com/users/volak/orgs","repos_url":"https://api.github.com/users/volak/repos","events_url":"https://api.github.com/users/volak/events{/privacy}","received_events_url":"https://api.github.com/users/volak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-30T06:33:29Z","updated_at":"2018-05-22T03:48:11Z","closed_at":null,"author_association":"OWNER","body":"In NSB 6 I can't use request / response in message handlers - see https://github.com/Particular/NServiceBus.Callbacks/issues/42\n\nThe \"correct\" way to do this from what I'm told is to setup a saga which can collect replies from normal Sends and handle timeouts / retries and such in itself.\n\nIt sounds good - and sounds like something we can include in the library so users won't have to deal with that logic themselves\n"},"comment":{"url":"https://api.github.com/repos/volak/Aggregates.NET/issues/comments/390854130","html_url":"https://github.com/volak/Aggregates.NET/issues/11#issuecomment-390854130","issue_url":"https://api.github.com/repos/volak/Aggregates.NET/issues/11","id":390854130,"user":{"login":"volak","id":1750226,"avatar_url":"https://avatars3.githubusercontent.com/u/1750226?v=4","gravatar_id":"","url":"https://api.github.com/users/volak","html_url":"https://github.com/volak","followers_url":"https://api.github.com/users/volak/followers","following_url":"https://api.github.com/users/volak/following{/other_user}","gists_url":"https://api.github.com/users/volak/gists{/gist_id}","starred_url":"https://api.github.com/users/volak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volak/subscriptions","organizations_url":"https://api.github.com/users/volak/orgs","repos_url":"https://api.github.com/users/volak/repos","events_url":"https://api.github.com/users/volak/events{/privacy}","received_events_url":"https://api.github.com/users/volak/received_events","type":"User","site_admin":false},"created_at":"2018-05-22T03:48:11Z","updated_at":"2018-05-22T03:48:11Z","author_association":"OWNER","body":"I added a small extension `IMessageHandleContext.LocalSaga` to help with sending a series of commands from message handlers.\r\n\r\nUsage is like so:\r\n\r\n```\r\npublic void Handle(Commands.DoSomethingComplicated command, IMessageHandlerContext ctx) {\r\n   var complicated = await ctx.For<Complicated>().Get(command.ComplicatedId);\r\n   await ctx.LocalSaga(async bus => {\r\n       var reply = await bus.Request<bool>(new Commands.StartSomething{ ComplicatedId = complicated.Id });\r\n       complicated.Success = reply;\r\n   });\r\n}\r\n```\r\n\r\nawaiting ctx.LocalSaga will pause the command processing until the saga function is complete."}}
{"actor":{"display_login":"volak"}}