{"action":"created","issue":{"url":"https://api.github.com/repos/justeat/JustSaying/issues/79","labels_url":"https://api.github.com/repos/justeat/JustSaying/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/justeat/JustSaying/issues/79/comments","events_url":"https://api.github.com/repos/justeat/JustSaying/issues/79/events","html_url":"https://github.com/justeat/JustSaying/issues/79","id":81926639,"number":79,"title":"SqsPointToPointSubscriber creates too many queues, and does not handle messages","user":{"login":"dariusdamalakas","id":131102,"avatar_url":"https://avatars.githubusercontent.com/u/131102?v=3","gravatar_id":"","url":"https://api.github.com/users/dariusdamalakas","html_url":"https://github.com/dariusdamalakas","followers_url":"https://api.github.com/users/dariusdamalakas/followers","following_url":"https://api.github.com/users/dariusdamalakas/following{/other_user}","gists_url":"https://api.github.com/users/dariusdamalakas/gists{/gist_id}","starred_url":"https://api.github.com/users/dariusdamalakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dariusdamalakas/subscriptions","organizations_url":"https://api.github.com/users/dariusdamalakas/orgs","repos_url":"https://api.github.com/users/dariusdamalakas/repos","events_url":"https://api.github.com/users/dariusdamalakas/events{/privacy}","received_events_url":"https://api.github.com/users/dariusdamalakas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/justeat/JustSaying/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"payman81","id":1409971,"avatar_url":"https://avatars.githubusercontent.com/u/1409971?v=3","gravatar_id":"","url":"https://api.github.com/users/payman81","html_url":"https://github.com/payman81","followers_url":"https://api.github.com/users/payman81/followers","following_url":"https://api.github.com/users/payman81/following{/other_user}","gists_url":"https://api.github.com/users/payman81/gists{/gist_id}","starred_url":"https://api.github.com/users/payman81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payman81/subscriptions","organizations_url":"https://api.github.com/users/payman81/orgs","repos_url":"https://api.github.com/users/payman81/repos","events_url":"https://api.github.com/users/payman81/events{/privacy}","received_events_url":"https://api.github.com/users/payman81/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-05-28T13:31:15Z","updated_at":"2015-06-04T10:01:40Z","closed_at":null,"body":"Hi\r\n\r\nThere's an issue with how SqsPointToPointSubscriber is creating queues. Below example should just create 1 queue, and should handle the message. Instead, it creates 3 queues and does not handle a message.\r\n\r\n````c#\r\nvar queue = \"MyQueue\";\r\nvar publisher = CreateMeABus.InRegion(RegionEndpoint.EUWest1.SystemName)\r\n                .WithSqsPointToPointSubscriber()\r\n                .IntoQueue(queue)\r\n                .WithMessageHandler<Message1>(new Handler1())\r\n                .WithMessageHandler<Message2>(new Handler2())\r\n                .WithSqsMessagePublisher<Message1>(config => config.QueueName = queue)\r\n                .WithSqsMessagePublisher<Message2>(config => config.QueueName = queue);\r\n\r\npublisher.StartListening();\r\n\r\npublisher.Publish(new Message2());\r\n````\r\n\r\nCode creates 3 queues:\r\n* message1-myqueue\r\n* message2-myqueue\r\n* message2-message1-myqueue\r\n\r\nSQS subscriber is listening on message1-myqueue and messagee2-message1-myqueue\r\nMessage is published on queue message2-myqueue\r\n\r\n\r\nI see a couple of issues with this behaviour\r\n1. The code does add a prefix to the queue name which is the message name. This is not evident from the fluent interface. I believe the intention here was to create queue per message, so that the bus would listen on each queue.  This is also different behaviour compared to SnsSubscriber, where only a single queue will be created. Perhaps there's a bug in there as well - maybe the intention is to have a queue per message type, and not a single queue with multiple listeners as it is now.\r\n2. Ref what has been said above, I expect this code to create just 1 queue. And not 3.\r\n3. Message is never handled due to a mismatch in queues"},"comment":{"url":"https://api.github.com/repos/justeat/JustSaying/issues/comments/108816888","html_url":"https://github.com/justeat/JustSaying/issues/79#issuecomment-108816888","issue_url":"https://api.github.com/repos/justeat/JustSaying/issues/79","id":108816888,"user":{"login":"dariusdamalakas","id":131102,"avatar_url":"https://avatars.githubusercontent.com/u/131102?v=3","gravatar_id":"","url":"https://api.github.com/users/dariusdamalakas","html_url":"https://github.com/dariusdamalakas","followers_url":"https://api.github.com/users/dariusdamalakas/followers","following_url":"https://api.github.com/users/dariusdamalakas/following{/other_user}","gists_url":"https://api.github.com/users/dariusdamalakas/gists{/gist_id}","starred_url":"https://api.github.com/users/dariusdamalakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dariusdamalakas/subscriptions","organizations_url":"https://api.github.com/users/dariusdamalakas/orgs","repos_url":"https://api.github.com/users/dariusdamalakas/repos","events_url":"https://api.github.com/users/dariusdamalakas/events{/privacy}","received_events_url":"https://api.github.com/users/dariusdamalakas/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T10:01:39Z","updated_at":"2015-06-04T10:01:39Z","body":"@payman81, thanks, no worries. TBH, am not in a position to submit a PR at the moment too, code is not up to the standards. But just to give a quick idea of what the solution we come up - all logic concerning topic and queue name creation was brought into a new IBusNamingConvention interface. The default implementation creates topic names based on message type name, and queue name is what get's pased in IntoQueue() method. Also added a config option to override this, so now it's possible take in control queue and topic naming. \r\n\r\n````c#\r\njustSaying = CreateMeABus\r\n                .InRegion(\"region\")\r\n                .WithNamingStrategy(() => busNamingConvention)\r\n                .WithSqsPointToPointSubscriber()\r\n                .IntoQueue(\"queue1\")\r\n                .WithMessageHandler<Message1>(handlerResolver)\r\n\r\n````"}}