Cut your hair and get an azure webjob
-
Upload
mark-greenway -
Category
Technology
-
view
113 -
download
3
description
Transcript of Cut your hair and get an azure webjob
CUT YOUR HAIR AND GET AN AZURE WEBJOB!
Mark Greenway@MarkKGreenway
Who | What | When | Where | Why | How | OMG WHY?!
THANKS SPONSORS!
Who | What | When | Where | Why | How | OMG WHY?!
Who the #$@& is this guy??
Him
WHO | What | When | Where | Why | How | OMG WHY?!
What is an Azure WebJob?
Who| WHAT | When | Where | Why | How | OMG WHY?!
Location NameAzure PaaS WebJobAzure PaaS
(old)Worker Role
Heroku WorkerApp Harbor Worker Unithttps://flic.kr/p/5uJsLG
What is an Azure WebJob?
Who| WHAT | When | Where | Why | How | OMG WHY?!
Options
Powershell
.BAT (Batch file)
Node.JS
Python
.exe
.NET Applicationhttps://flic.kr/p/a2qceu
What is an Azure WebJob?
Who| WHAT | When | Where | Why | How | OMG WHY?!
Can’t do
Run Servers
Invoke Server Applications
https://flic.kr/p/a2qceu
When Does an Azure WebJob Run?
Who| What | WHEN | Where | Why | How | OMG WHY?!
1. Triggered
2. Continuous
© 2013 Tim Buss
When Does an Azure WebJob Run?
Who| What | WHEN | Where | Why | How | OMG WHY?!
1. Triggered
© 2013 Tim Buss
• Scheduled• Manual
When Does an Azure WebJob Run?
Who| What | WHEN | Where | Why | How | OMG WHY?!
2. Continuous
© 2013 Tim Buss
• Runs All The Time (with Always On)• .NET Triggers Run (with SDK)
Where Does an Azure WebJob Run?
Who| What | When | WHERE | Why | How | OMG WHY?!
1. With An Azure Website (W/AWS)
https://flic.kr/p/7fXoky
• Logically bound to a particular site• Deployment options
• Separate Manual Deployment• CLI• Web Interface
• Continuous Deployment with site• 1 …n
Where Does an Azure WebJob Run?
2. With Only Other Azure WebJobs
https://flic.kr/p/ajkTkm
• Not Logically bound to a particular site• Deployment options
• Separate Manual Deployment• CLI• Web Interface
• Independent git etc deployments.• 1 …n
Who| What | When | WHERE | Why | How | OMG WHY?!
Who| What | When | Where | WHY | How | OMG WHY?!
Why Use A WebJob:
• Process Log Files• Process Orders• Migrate Deleted Items to Long term storage• Compress Uploaded Images• Add Watermarks to Images• Run Nightly Tasks• Import on premise data to azure• Manage Videos for Smooth Streaming • RSS Aggregation• Migrating Log Files• Long Running Tasks • Complex Creation of User Records
• Interaction with slow 3rd party systems• Convert JSON to XML • Email users• Decoupling• Scalability• OCR• Billing
How to Manually Upload A WebJob :
1. Put files into a folder 2. Zip all the files in the folder 3. Go to Web or CLI
Who| What | When | Where | Why | HOW | OMG WHY?!
How to “PiggyBack” Upload A WebJob :
1. Put files into a folder 2. Copy that folder to
App_Data/jobs/[continuous,triggered]/3. Deploy As Usual
Who| What | When | Where | Why | HOW | OMG WHY?!
How to Continuously Upload A WebJob :
Who| What | When | Where | Why | HOW | OMG WHY?!
1. Create Project in Same Solution2. Modify Build to copy that folder to
App_Data/jobs/[continuous,triggered]/3. Deploy As Usual
How to Continuously Upload A WebJob :
1. Create Project in Same Solution2. Modify Build to copy that folder to
App_Data/jobs/[continuous,triggered]/3. Deploy As Usual
*Heavily Photoshopped for Clarity
Who| What | When | Where | Why | HOW | OMG WHY?!
How to create a .NET WebJob
Who| What | When | Where | Why | HOW | OMG WHY?!
1. File -> New -> Console Application 2. Add NuGet Packages for extra tooling
How to create a .NET WebJob
Who| What | When | Where | Why | HOW | OMG WHY?!
static void Main(){ var host = new JobHost(); host.RunAndBlock();}public static void AzureQueue([QueueTrigger("myqueue")] string userJson) {}public static void AzureQueueObject([QueueTrigger("myqueue")] Person person) {}public static void SbQueue([ServiceBusTrigger("sbqueue")] string person) {}public static void SbQueueObject([ServiceBusTrigger("sbobjectqueue")] Person person) {}public static void Resize( [BlobTrigger(@"images-input/{name}")] WebImage input, [Blob(@"images-output/{name}")] out WebImage output) {}
How to TEST a .NET WebJob
Who| What | When | Where | Why | HOW | OMG WHY?!
//IN WEBJOB CLASSpublic static Person LastPerson { get; set; }public static void SbQueueObject([ServiceBusTrigger("sbobjectqueue")] Person person){ LastPerson = person; Console.WriteLine("Service Bus Object Queue : {0}", person);}
//IN TEST CLASS[Test]public void PersonSetsLastPerson(){ var dawn = PersonCreator.CreatePerson("Dawn"); ImageProcessing.SbQueueObject(dawn); Assert.AreEqual(dawn,ImageProcessing.LastPerson);}
How to Debug a .NET WebJob
Who| What | When | Where | Why | HOW | OMG WHY?!
https://cutyourhair.scm.azurewebsites.net/azurejobs/#/jobs
1.Use A Backplane2.Post Directly to the Backplane
How to Update SignalR from a WebJob
Who| What | When | Where | Why | How | OMG WHY?!
How to Update SignalR from a WebJob
Who| What | When | Where | Why | How | OMG WHY?!
How to Update SignalR from a WebJob
Who| What | When | Where | Why | How | OMG WHY?!
Who| What | When | Where | Why | How | OMG WHY?!
https://twitter.com/rustdPranav RastogiProgram Manager, Azure WebJobs, ASP.NET
http://blog.amitapple.com/Amit AppleSenior Software Developer, Azure Web Sites
Who To Follow:
http://twitter.com/shanselmanScott HanselmanMicrosoft
http://Friday.Azure.com
Learn More:
Who| What | When | Where | Why | How | OMG WHY?!
Mark Greenway@MarkKGreenway