380 likes | 507 Views
Developing Java Applications with Windows Azure. Steve Marx Technical Strategist Microsoft Corporation. Are you fluent in Java?. Are you fluent in Windows Azure?. Instant Poll Results. Instant Poll Results. Instant Poll Results. Instant Poll Results. Windows Azure Refresher.
E N D
Developing Java Applications with Windows Azure Steve Marx Technical Strategist Microsoft Corporation
Windows Azure Refresher • Scalable computation in the cloud • Durable cloud storage • Write code, test, debug locally • Automated management in the cloud • Utility business model
What We’ll Build Worker Role Worker Role JRE Web Role Web Role Tomcat LB Storage http://hellojava.cloudapp.net
How It Works • Platform features: • Native code execution (run the JVM) • Local storage (Tomcat logs, etc.) • Worker roles with endpoints (listen on port 80) • Initialization (copy and launch Tomcat) • Java-specific artifacts: • Java storage client library • Apache Tomcat solution accelerator • (Eclipse tooling)
Mental Model • Windows • Non-admin user • USB drive with “runme.bat” • Can your app run that way?
Windows Azure Storage • Windows Azure Storage • Blobs, tables, queues, drives • Highly scalable • REST interface • Java storage library (windowsazure4j.org) • Built by Soyatec
Using the Windows Azure SDK for Java • Download library and dependencies • Create a storage account • Read and write blob “count.txt”
Running Tomcat in Windows Azure • Use the solution accelerator; it’s easier • Built by our partner Infosys • To do it yourself: • Copy Tomcat to local storage • Configure correct listening port • Start Tomcat service • Monitor and report health
Using the Tomcat Solution Accelerator • Download accelerator, Tomcat, and JRE • buildme.cmd – copy bits and build • runme.cmd – run locally • packme.cmd – package for the cloud
What Happens When Everyone Clicks? • Multiple instances accessing blob • Problem: • Solution: • Optimistic concurrency • Asynchronous so you can “catch up”
Asynchronous Web/Worker Architecture • Loosely-coupled system with queues • Benefits: • Scalability • Availability • Fault tolerance • Best practice design JRE Web Role Web Role Tomcat LB Storage
Worker Role Programming Model • Basically DLL with main() • In .NET • OnStart() – initialization • Run() – main • OnStop() – graceful shutdown • Expected to run forever
Java Worker demo
Anatomy of a Java Worker Role Worker Role Process.Start() Worker .class Run() Worker .dll JRE .NET
Creating a Java Worker Role • Include JRE in worker role • Launch java.exe with our class
Java Worker Role demo
A Better Java Worker • Reading configuration settings • Discovering endpoints • Handling changes • Monitoring • Diagnostics
That’s a Big Package • Our package now contains: • Tomcat • Two copies of the JRE • Our application • Deploy the package from blob storage • Consider moving things out • Deploy only application bits • Copy dependencies (Tomcat, JRE) from blobs
What We Built Worker Role Worker Role JRE Web Role Web Role Tomcat LB Storage http://hellojava.cloudapp.net
Windows Azure Platform AppFabric • HTTP Client Support (RESTful API) • Access Control Service • Token requests and token validate • Management API (scope and rule management) • Protocol and token interoperability • OAuth Web Resource Authorization Protocol (WRAP) • Simple Web Token (SWT) definition • Service Bus Message Buffers • Message consumers can use HTTP polling • Enables mobile, web and non-.NET platforms • Secure with WRAP/SWT using Access Control • Java SDK - http://www.jdotnetservices.com
SQL Azure Database • SQL Azure Database • Full relational Database as a Service • Direct connectivity to SQL Azure • Connect with JDBC/ODBC using the latest driver • Eclipse tooling support • Interoperability using REST • Easily wrap SQL Azure with ADO.NET Data Services • Java Client Toolkit for ADO.NET Data Services • Committed to OSS support and app compatibility
Key Takeaways • Powerful platform primitives • You don’t need us • Worker role with endpoint is a flexible model • Partners to make life easier • Soyatec – Eclipse tools and Java storage library • Infosys – Tomcat solution accelerator
YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation forms online at MicrosoftPDC.com
Learn More On Channel 9 • Expand your PDC experience through Channel 9 • Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses channel9.msdn.com/learn Built by Developers for Developers….
Resources • Downloads:http://windowsazure.com/interoperability • Me:http://blog.smarx.com (get the source!)http://twitter.com/smarx • PHP, MySQL, and memcached talk:Right here, next (4:30)