{"action":"created","issue":{"url":"https://api.github.com/repos/MassTransit/MassTransit/issues/650","repository_url":"https://api.github.com/repos/MassTransit/MassTransit","labels_url":"https://api.github.com/repos/MassTransit/MassTransit/issues/650/labels{/name}","comments_url":"https://api.github.com/repos/MassTransit/MassTransit/issues/650/comments","events_url":"https://api.github.com/repos/MassTransit/MassTransit/issues/650/events","html_url":"https://github.com/MassTransit/MassTransit/issues/650","id":177151768,"number":650,"title":"azure web jobs sdk binding","user":{"login":"stombeur","id":5495297,"avatar_url":"https://avatars.githubusercontent.com/u/5495297?v=3","gravatar_id":"","url":"https://api.github.com/users/stombeur","html_url":"https://github.com/stombeur","followers_url":"https://api.github.com/users/stombeur/followers","following_url":"https://api.github.com/users/stombeur/following{/other_user}","gists_url":"https://api.github.com/users/stombeur/gists{/gist_id}","starred_url":"https://api.github.com/users/stombeur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stombeur/subscriptions","organizations_url":"https://api.github.com/users/stombeur/orgs","repos_url":"https://api.github.com/users/stombeur/repos","events_url":"https://api.github.com/users/stombeur/events{/privacy}","received_events_url":"https://api.github.com/users/stombeur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-15T11:26:10Z","updated_at":"2016-11-27T20:45:28Z","closed_at":null,"body":"I'm looking at azure web jobs and I was wondering if you have considered creating a binding for masstransit to allow an azure web job to be triggered by a message received on the bus. \n\nI know the best answer to this question is \"yes, just send us a PR\" but before I dive deep into it I want to know if\n- it is feasible\n- it is an interesting feature\n  (I'm not that familiar yet with masstransit)\n\ncheers!\n"},"comment":{"url":"https://api.github.com/repos/MassTransit/MassTransit/issues/comments/263146322","html_url":"https://github.com/MassTransit/MassTransit/issues/650#issuecomment-263146322","issue_url":"https://api.github.com/repos/MassTransit/MassTransit/issues/650","id":263146322,"user":{"login":"bakatz","id":1575240,"avatar_url":"https://avatars.githubusercontent.com/u/1575240?v=3","gravatar_id":"","url":"https://api.github.com/users/bakatz","html_url":"https://github.com/bakatz","followers_url":"https://api.github.com/users/bakatz/followers","following_url":"https://api.github.com/users/bakatz/following{/other_user}","gists_url":"https://api.github.com/users/bakatz/gists{/gist_id}","starred_url":"https://api.github.com/users/bakatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bakatz/subscriptions","organizations_url":"https://api.github.com/users/bakatz/orgs","repos_url":"https://api.github.com/users/bakatz/repos","events_url":"https://api.github.com/users/bakatz/events{/privacy}","received_events_url":"https://api.github.com/users/bakatz/received_events","type":"User","site_admin":false},"created_at":"2016-11-27T20:45:28Z","updated_at":"2016-11-27T20:45:28Z","body":"@phatboyg \r\n\r\nSo, this is going to be a wall of text. I wrote my comment before I had much of a chance to evaluate webjobs, but as of now I've evaluated all 4 \"host your app on azure\" products (webjobs, app services, classic cloud services, and azure functions) and have now written some interop code that allows masstransit messages to be consumed by webjobs, so maybe I can provide some insight into all the different products you mentioned:\r\n\r\n1. App Service (synonym: \"Azure Web Sites\") is a platform used to easily host apps on azure. Multiple App Services can share a single App Service Plan (which defines the CPU, RAM, etc. for your group of services). With just an app service by itself, you can deploy a web app to azure and have it run on IIS with SSL w/o much extra work relative to the work required for Cloud Services. Tradeoff is that you can't remote into the nodes in your app service, but they do give you an in-browser powershell console (along with a normal cmd.exe shell).\r\n\r\n1. WebJobs are just console apps that are hosted/managed by App Service. App Service ensures that the webjobs get restarted when they crash, started on boot, etc.\r\n\r\n2. Functions are a fork of WebJobs that are also hosted by App Service Plans, except scaling is handled automatically / pricing is based on # of requests to your function, not the specific resources you provision (so the App Service Plan is dynamic and is determined by Microsoft, not you). This is an equivalent offering to AWS Lambda, and functions are very exciting, but they just came out of \"preview\" and the tooling still isn't production ready (i.e. local development/testing appears to be difficult since all C# functions have to be written as .csx files) so I'm not using them for production.\r\n\r\n3. I wouldn't bother with service fabric. It was a buggy mess the last time I used it: my entire cluster essentially exploded when I tried to do an ARM deployment to scale up the number of nodes in the cluster. Also had to use certificates to manage my nodes, which was a pain (each developer had to install a cert on their machine to be able to log in to the service fabric management UI). It seems like it's a half baked attempt at an equivalent of Kubernetes + Docker.\r\n\r\nAnyway, tl;dr: I like web jobs and app services. They're stable and work correctly. For web jobs, in order to receive/send service bus messages, you define a method that looks like this: \r\n\r\n    public static void DoSomethingOnMessageReceived([ServiceBusTrigger(\"some-input-topic\", \"subscriber-name\") YourEventClass event, [ServiceBus](\"some-output-event-queue-or-topic\") ICollector<MessageProcessedEvent> outputQueue) {\r\n    // Do some processing on the event\r\n    //...\r\n    outputQueue.Add(new MessageProcessedEvent()); // send a queue *or topic* message saying that the message was processed\r\n    }\r\n\r\n\r\nAs you can see here, the function looks an awful lot like what you would write for a MassTransit consumer, and in fact, webjobs does a lot of the same things that MT does behind the scenes (manages retries, serialization, batching, etc). The problem is that, in order to interop with masstransit, you have to do several things:\r\n\r\n1. Write out the entire autogenerated MT topic name as a string i.e. [ServiceBusTrigger(\"yourcompany.messaging.v1.somenamespace.someevent\")]. This is pretty ugly.\r\n\r\n2. Since MT uses a non-standard content type, you need to write a custom message processor to force each message sent by MT to have the \"application/json\" content type instead of the \"vnd/masstransit+json\" content type or whatever it is, otherwise WebJobs doesn't recognize the message as something it can serialize. \r\n\r\n3. You need to wrap each message in an envelope class with a \"Message\" property, since MT uses a custom envelope for each message.\r\n\r\nLike I mentioned, I already wrote some code that gets around the above problems (and I'm not sure what my company's open source policy is, so I can't share right now), but it would be ideal to have an officially supported MassTransitTriggerAttribute and MassTransitOutputAttribute that looks something like this: `[MassTransitTrigger(typeof(Message))]` and `[MassTransitOutput(typeof(SomeOtherMessage))]`"}}
{"actor":{"display_login":"bakatz"}}