Supporting Offline Application Mode With WCF

Uploaded from authorPOINT
Views:
 
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Supporting Offline Application Mode with WCF: 

Supporting Offline Application Mode with WCF Tom Fuller, MVP MCSD.NET Microsoft MVP – Solution Architect President of Tampa Bay IASA Founder of SOAPitStop.com Duration: 60 Minutes

Getting To Know Me: 

Getting To Know Me Professional Experience Community Involvement Published Work

Presentation 411: 

Our Objective Understand the terms and technologies for supporting offline mode Learn what WS-RM and System.Messaging provide See examples of how WCF can implement offline mode capabilities See other existing techniques and future enhancements that will support offline mode Presentation 411

The Foundations: 

Sections What is a Smart Client anyway? Architecting for Better UX Basic Design Concepts (Replicate vs. Push vs. Pull vs. Callback) Doing Async the 'Right-Way' The Foundations

What is a “Smart” Client anyway?: 

Smart Client Checklist Must be capable of making use of peripherals Must have some type of external dependency Automatic installation and updating Device/Platform flexibility Controlled privilege on target platform Must be capable of supporting offline mode What is a 'Smart' Client anyway?

Architecting for Better UX: 

Why do we care about this Users demand better experiences Your applications will find new environments Only if they have flexibility I still like my thin clients and I think AJAX is really cool Even with AJAX there are things you can not do Architecting for Better UX

What is a “Smart” Client anyway?: 

When is offline mode appropriate Operations should be replayable Single service requests Data dependencies should be minimized Keep these types of services explicit What is a 'Smart' Client anyway?

Basic Design Concepts: 

Common design elements A persistence strategy A correlation strategy Manager/dispatcher capabilities Transport resiliency Failover to offline (optional) Basic Design Concepts

Basic Design Concepts: 

Understanding the Replication Model Basic Design Concepts

Basic Design Concepts: 

Understanding the Push Model Basic Design Concepts

Basic Design Concepts: 

Understanding the Pull Model Basic Design Concepts

Basic Design Concepts: 

Understanding the Callback Model Basic Design Concepts

Doing Async The “Right-Way”: 

Partial Async Programming Model Begin/End Check back later Reporting dashboards Scheduled jobs Ping until your done Very chatty but effective Doing Async The 'Right-Way'

WS-RM / System.Messaging: 

Sections What does WS-RM do? An MSMQ Primer System.Messaging basics Advanced messaging topics WS-RM / System.Messaging

What does WS-RM do?: 

WS-ReliableMessaging Like any WS* spec these are implemented as a set of SOAP Headers Meant to facilitate replay, ordering, and duplication detection of messages Four basic 'Assurances' AtMostOnce AtLeastOnce ExactlyOnce InOrder Allows for 'conversations' between client/service What does WS-RM do?

An Example Conversation: 

An Example Conversation

WS-RM in WCF: 

So what does this mean for me? If you can communicate in a reliable way you may not need offline capability 'TCP at the SOAP level' (courtesy of Shy Cohen) Probably not the best thing to use in a truly disconnected mode application Only meant for small temporary outages that would impact the integrity of a series of messages WS-RM in WCF

An MSMQ Primer: 

Message Queuing (MSMQ) It’s part of the platform! This technology is what truly adds resiliency to an application Support on Windows XP/Win 2K3 (MSMQ 3) and Windows Vista (MSMQ 4) Types of queues: Private (\private$), Public (in AD), Outgoing, Admin, Response, Dead-Letter, Poison, Sub (only in 4.0), Journal, and Report Has transactional capability Define triggers for asynchronous processing (COM Interop) An MSMQ Primer

An MSMQ Primer: 

An MSMQ Primer

MSMQ in the Enterprise: 

Can it scale? Deploy it to a clustered set of servers Is it secure? You can use HTTPs Access control capable What about performance? Reports against IBM MQSeries As is the case with most scalability models with Microsoft … add more servers (scale horizontally) MSMQ in the Enterprise

System.Messaging Basics: 

API for MSMQ Main class 'MessageQueue' Able to create a queue, read, write Able to enlist in dtc transactions New in .NET 2.0 Quick lookupid Integrated with System.Transactions New native MSMQ cursor Programmatic control over multi-cast addresssing System.Messaging Basics

An MSMQ Primer: 

Demo 1 System.Messaging, MSMQ 4.0 An MSMQ Primer

Advanced Messaging Topics: 

Tuning for high performance Turn off Exactly Once, transacted batching, Use non-transactional and set Durable to false Poison Message Handling MSMQ 4 has a much better approach for this Integration MSMQ – MQSeries Bridge Design considerations Correlation Durability Recoverable Messages Advanced Messaging Topics

Application Offline Mode in WCF: 

Sections Understanding the Bindings Message Exchange Patterns (MEP) Explanation of message integration Full Demo Application Offline Mode in WCF

Understanding the Bindings: 

The anatomy of a binding This is 'How' your service is supposed to communicate The binding elements are the key building block Order is important! It’s not complicated, just think about it as a pipeline Understanding the Bindings

Understanding the Bindings: 

netMsmqBinding Extends the MSMQBindingBase Understanding the Bindings andlt;netMsmqBindingandgt; andlt;binding name='UpdateCustomerDetail' closeTimeout='00:01:00' openTimeout='00:01:00' receiveTimeout='00:10:00' sendTimeout='00:01:00' deadLetterQueue='System' durable='true' exactlyOnce='true' maxReceivedMessageSize='65536' maxRetryCycles='2' receiveRetryCount='5' retryCycleDelay='00:30:00' timeToLive='1.00:00:00' useSourceJournal='false' andgt; andlt;readerQuotas maxDepth='32' /andgt; andlt;security mode='None'andgt; andlt;transport msmqAuthenticationMode='WindowsDomain' msmqEncryptionAlgorithm='RC4Stream' msmqProtectionLevel='Sign' msmqSecureHashAlgorithm='Sha1' /andgt; andlt;message clientCredentialType='Windows' /andgt; andlt;/securityandgt; andlt;/bindingandgt; andlt;/netMsmqBindingandgt;

Understanding the Bindings: 

netMsmqBindingElement Collection Understanding the Bindings

Using One-Way Invocation: 

Contract definition Remember, netMsmqBinding only supports one-way ServiceContract/OperationContract Using One-Way Invocation [ServiceContract] class UpdateCustomerDetail { [OperationContract(IsOneWay=true)] void UpdateCustomer(UpdateCustomerDetailRequest req) { //TODO: Implementation here } }

Understanding the Bindings: 

MsmqIntegrationBinding Lives in another namespace System.ServiceModel.MsmqIntegration Extends the same base class MsmqBindingBase MSMQ Message andlt;andgt; WCF Message There are many differences when you look at the binding code No message security Limited contract flexibility No message encoder Intended for already existing MSMQ applications Understanding the Bindings

Understanding the Bindings: 

MsmqIntegrationBindingElement Collection Understanding the Bindings

An MSMQ Primer: 

Demo 2 WCF Using netMsmqBinding An MSMQ Primer

Other Techniques / Futures: 

Sections Smart Client Offline Application Block What’s new in Vista / MSMQ 4.0 Possible marriage of WS-RM / MSMQ What about Mobile / Compact Framework Other Techniques / Futures

Smart Client Offline Application Block: 

High Level Architecture Scenarios where you would use this over WCF Smart Client Offline Application Block

What’s New in Vista / MSMQ 4.0: 

A whole new version of MSMQ Poison message handling Distributed Transacted reads Subqueues Application specific dead-letter queues How about the combination of WCF/WF via MSMQ (DinnerNow.Net) What’s New in Vista / MSMQ 4.0

Possible Marriage of WS-RM and MSMQ: 

There are obvious overlaps If you want the time independence but don’t care about the loose coupling at the message level Having both would be very powerful You kind of have some of it today Batched transactions Exactly once delivery Possible Marriage of WS-RM and MSMQ

What about Mobile / Compact Framework: 

Planning is underway for WCF with queued transport on the handheld. Will not likely contain the full ServiceModel Initial POC using email as the transport MSMQ is supported What about Mobile / Compact Framework

Resources: 

David Hill’s Blog: http://blogs.msdn.com/dphill/articles/66300.aspx WS-ReliableMessaging Specification Index Page: http://msdn2.microsoft.com/en-us/library/ms951271.aspx WS-ReliableMessaging spec: http://specs.xmlsoap.org/ws/2005/02/rm/ws-reliablemessaging.pdf Smart Client Offline Application Block: http://msdn2.microsoft.com/en-us/library/ms998460.aspx WCF Architecture Overview: http://msdn2.microsoft.com/en-us/library/aa480210.aspx Nick Allen’s (Dr. Nick) Blog: http://blogs.msdn.com/drnick Contact me –tom.fuller@bluearchsolutions.com, www.soapitstop.com Resources