{"action":"created","issue":{"url":"https://api.github.com/repos/aduis/hapi-rabbit/issues/5","labels_url":"https://api.github.com/repos/aduis/hapi-rabbit/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/aduis/hapi-rabbit/issues/5/comments","events_url":"https://api.github.com/repos/aduis/hapi-rabbit/issues/5/events","html_url":"https://github.com/aduis/hapi-rabbit/issues/5","id":106617236,"number":5,"title":"Question: Plugin vs Native Rabbit","user":{"login":"astanciu","id":1675025,"avatar_url":"https://avatars.githubusercontent.com/u/1675025?v=3","gravatar_id":"","url":"https://api.github.com/users/astanciu","html_url":"https://github.com/astanciu","followers_url":"https://api.github.com/users/astanciu/followers","following_url":"https://api.github.com/users/astanciu/following{/other_user}","gists_url":"https://api.github.com/users/astanciu/gists{/gist_id}","starred_url":"https://api.github.com/users/astanciu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astanciu/subscriptions","organizations_url":"https://api.github.com/users/astanciu/orgs","repos_url":"https://api.github.com/users/astanciu/repos","events_url":"https://api.github.com/users/astanciu/events{/privacy}","received_events_url":"https://api.github.com/users/astanciu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-15T18:33:00Z","updated_at":"2015-09-26T09:31:05Z","closed_at":null,"body":"This may be a dumb question but I'm not sure I understand what you get by making this a plugin versus just using a native RabbitMQ module? I'd really appreciate it if someone can explain this to me.\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/aduis/hapi-rabbit/issues/comments/143414802","html_url":"https://github.com/aduis/hapi-rabbit/issues/5#issuecomment-143414802","issue_url":"https://api.github.com/repos/aduis/hapi-rabbit/issues/5","id":143414802,"user":{"login":"aduis","id":777418,"avatar_url":"https://avatars.githubusercontent.com/u/777418?v=3","gravatar_id":"","url":"https://api.github.com/users/aduis","html_url":"https://github.com/aduis","followers_url":"https://api.github.com/users/aduis/followers","following_url":"https://api.github.com/users/aduis/following{/other_user}","gists_url":"https://api.github.com/users/aduis/gists{/gist_id}","starred_url":"https://api.github.com/users/aduis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduis/subscriptions","organizations_url":"https://api.github.com/users/aduis/orgs","repos_url":"https://api.github.com/users/aduis/repos","events_url":"https://api.github.com/users/aduis/events{/privacy}","received_events_url":"https://api.github.com/users/aduis/received_events","type":"User","site_admin":false},"created_at":"2015-09-26T09:31:05Z","updated_at":"2015-09-26T09:31:05Z","body":"hey, thanks for your question. the package should simplify the usage of rabbitmq. I've created it for my own projects. there are several routing options and conventions that I don't want repeat every time I want to publish a message.\r\n\r\nfor example the first option is much shorter and easier to understand than the second option:\r\n\r\n--option 1\r\nrabbit.createContext(function(err, context){\r\n    if(err){\r\n        console.log('err', err);\r\n    }\r\n\r\n    rabbit.publish(context, 'exchange', 'messageType', 'message', function(err, data){\r\n        console.log('messageObject', data);\r\n    });\r\n});\r\n\r\n--option 2\r\nvar pub = context.socket('PUB', {routing: options.routing});\r\n\r\nvar messageObject = {\r\n    type: messageType,\r\n    data: message\r\n};\r\n\r\npub.connect(exchange, function () {\r\n    if(options.hasOwnProperty('extras')) {\r\n        for (var key in options.extras) {\r\n            pub.setsockopt(key, options.extras[key]);\r\n        }\r\n    }\r\n    \r\n    pub.publish(exchange + '.' + messageType, JSON.stringify(messageObject));\r\n    callback(null, messageObject);\r\n});\r\n\r\n "}}