{"action":"created","issue":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/3214","labels_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3214/labels{/name}","comments_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3214/comments","events_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3214/events","html_url":"https://github.com/Particular/NServiceBus/issues/3214","id":121966007,"number":3214,"title":"IDispatchMessages and the casting of AddressTag","user":{"login":"johnsimons","id":122651,"avatar_url":"https://avatars.githubusercontent.com/u/122651?v=3","gravatar_id":"","url":"https://api.github.com/users/johnsimons","html_url":"https://github.com/johnsimons","followers_url":"https://api.github.com/users/johnsimons/followers","following_url":"https://api.github.com/users/johnsimons/following{/other_user}","gists_url":"https://api.github.com/users/johnsimons/gists{/gist_id}","starred_url":"https://api.github.com/users/johnsimons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnsimons/subscriptions","organizations_url":"https://api.github.com/users/johnsimons/orgs","repos_url":"https://api.github.com/users/johnsimons/repos","events_url":"https://api.github.com/users/johnsimons/events{/privacy}","received_events_url":"https://api.github.com/users/johnsimons/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Particular/NServiceBus/labels/State:%20In%20Progress","name":"State: In Progress","color":"ededed"},{"url":"https://api.github.com/repos/Particular/NServiceBus/labels/Type:%20Refactoring","name":"Type: Refactoring","color":"d7e102"}],"state":"open","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/Particular/NServiceBus/milestones/62","html_url":"https://github.com/Particular/NServiceBus/milestones/6.0.0","labels_url":"https://api.github.com/repos/Particular/NServiceBus/milestones/62/labels","id":704266,"number":62,"title":"6.0.0","description":"Setting up deployment process","creator":{"login":"SimonCropp","id":122666,"avatar_url":"https://avatars.githubusercontent.com/u/122666?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonCropp","html_url":"https://github.com/SimonCropp","followers_url":"https://api.github.com/users/SimonCropp/followers","following_url":"https://api.github.com/users/SimonCropp/following{/other_user}","gists_url":"https://api.github.com/users/SimonCropp/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonCropp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonCropp/subscriptions","organizations_url":"https://api.github.com/users/SimonCropp/orgs","repos_url":"https://api.github.com/users/SimonCropp/repos","events_url":"https://api.github.com/users/SimonCropp/events{/privacy}","received_events_url":"https://api.github.com/users/SimonCropp/received_events","type":"User","site_admin":false},"open_issues":43,"closed_issues":142,"state":"open","created_at":"2014-06-28T13:41:09Z","updated_at":"2016-01-06T15:15:46Z","due_on":null,"closed_at":null},"comments":32,"created_at":"2015-12-14T03:01:05Z","updated_at":"2016-01-06T16:54:23Z","closed_at":null,"body":"@SzymonPobiega I am upgrading RabbitMQ transport with @mikeminutillo and I came across the AddressTag polymorphic property.\r\nIt seems for implementers to use this they always have to cast its value to either Uni or Multi, at least that is what [MSMQ](https://github.com/Particular/NServiceBus/blob/a9def8b16c7ac3e428fb5747dbc553517b8505ed/src/NServiceBus.Core/Transports/Msmq/MsmqMessageSender.cs#L52) and [Sql](https://github.com/Particular/NServiceBus.SqlServer/blob/221016197e4ae4f102dbeb0ea44b2fbd8e05d8ae/src/NServiceBus.SqlServer/Sending/MessageDispatcher.cs#L28) are doing\r\n\r\nIn the MSMQ implementation:\r\n```c#\r\nvar routingStrategy = dispatchOptions.AddressTag as UnicastAddressTag;\r\n```\r\n\r\nI wonder if we should have a chat and see if we can make it more discoverable and natural, thougths ?\r\n\r\nI was thinking of using two separate `Dispatch` methods, one for uni and another for multi, since Rabbit will use both. This way the contract is better expressed and there is no need for this casting or guessing what casting to use.\r\nFor MSMQ, you would just throw on the Multi.\r\n\r\nSo here is what I am proposing:\r\n```c#\r\npublic interface IDispatchMessages\r\n    {\r\n        Task Dispatch(IEnumerable<TransportOperation> outgoingMessages, ContextBag context, UnicastAddressTag routing);\r\n\r\n        Task Dispatch(IEnumerable<TransportOperation> outgoingMessages, ContextBag context, MulticastAddressTag routing);\r\n    }\r\n```\r\n\r\nor the other option is to make the publishing an explicit concept at the transport level so:\r\n```c#\r\npublic interface IDispatchMessages\r\n    {\r\n        Task Dispatch(IEnumerable<TransportOperation> outgoingMessages, ContextBag context, string destination);\r\n\r\n        Task Publish(IEnumerable<TransportOperation> outgoingMessages, ContextBag context, Type messageType);\r\n    }\r\n```\r\n\r\n@danielmarbach @SimonCropp @andreasohlund what do you think ?"},"comment":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/comments/169386343","html_url":"https://github.com/Particular/NServiceBus/issues/3214#issuecomment-169386343","issue_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3214","id":169386343,"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-01-06T16:54:22Z","updated_at":"2016-01-06T16:54:22Z","body":"please review #3295"}}