17
Elton Stoneman Microsoft MVP & Pluralsight Author http://particular.net Handling Failures with Messaging

Handling Failures with Messaging

Embed Size (px)

Citation preview

Page 1: Handling Failures with Messaging

Elton StonemanMicrosoft MVP & Pluralsight Author

http://particular.net

Handling Failures with Messaging

Page 2: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

•Types of failure

•Demo app

•Synchronous failure handling

•Asynchronous failure handling

•Messaging architecture

Outline

Page 3: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Distributed architectureTimeout / process overloadedTemporary – should retry

Transient Failures

DatabaseNetwork timeoutPool exhaustion

REST APIConnection timeout503 'Service Unavailable'

Page 4: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Contract changedAuthorization revokedPermanent – should not retry

Permanent Failures

DatabaseProcedure changePermission change

REST API400 'Bad Request'401 'Unauthorized'

Page 5: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Demo App

Web App REST APIs

Reliable (200)

Unreliable (200 or 503)

Broken (400)

Page 6: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Synchronous processingAPI calls with WebClientExceptions from non-OK result

App – V1

Page 7: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Demo – V1

No failure handlingBubble up to userTransient & permanent

Page 8: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Handling Failures

Type?

Audit

End

Retry

OK?

Failure

Transient

Permanent

Yes

No

Page 9: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Handling Failures

End

OK?

Failure

Transient

No

Yes

Permanent

Transient or permanent?Retry policiesAudit process

Type?

Audit

Retry

Page 10: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Simple failure handlingDetermine failure typeRetry transient; log permanent

App – V2

try {}catch {}

Page 11: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Demo – V2

Always appears successfulRetry options limitedAudit process basic

Page 12: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Business / technical fixFailure backlogReplay process

Replaying Failures

Page 13: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Asynchronous messagingWeb App sends messageHandler has retry & audit policy

App – V3

Page 14: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Integration happens offlineWider scope for retryFull details for replay

Demo – V3

Page 15: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

Messaging Architecture

MessageAll request dataProcessing data

QueueOrdered storeTransactions/ACKs

HandlerDecouples front-endCan be stopped

Page 16: Handling Failures with Messaging

Introduction to ServiceInsight for NServiceBusHandling Failures with Messaging

•Expect failure

•Handle failure in the right place

•Retry & backoff damages front-end

•Decoupled handlers have more options

•Persisted messages can be replayed

Summary

Page 17: Handling Failures with Messaging

Thank you

github.com/sixeyed/handling-failures

pluralsight.com/author/elton-stonemanq