Messaging Powered Front Ends

25
Elton Stoneman Microsoft MVP & Pluralsight Author http://particular.net Messaging Powered Front Ends

Transcript of Messaging Powered Front Ends

Page 1: Messaging Powered Front Ends

Elton StonemanMicrosoft MVP & Pluralsight Author

http://particular.net

Messaging Powered Front Ends

Page 2: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

•Channel to the User

•Broadcast Notifications

•Targeted Responses

•Fault Tolerance

•Scaling Concerns

Outline

Page 3: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Any back-end communicationClient callback mechanism Mobile push / WebSockets / polling

Channel to the User

BroadcastAll clientsPub-sub style

TargetedSingle clientReq-resp style

Page 4: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Two-way comms over TCP/IPPersistent connection (SPA)SignalR adds fault-tolerance

WebSockets & SignalR

Server.NET HubCan invoke client calls

ClientConnects to HubCan invoke server calls

Page 5: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Demo: Broadcast Notifications

Noticeboard Web App WebSockets & Messaging

Page 6: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Client-server call with SignalRWeb Server publishes to Exchange

Broadcast Notifications

exchange: noticeboard

SendMailRequest

Page 7: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Exchange bound to QueuesWeb Server listens on Queue

Broadcast Notifications

exchange: noticeboard

SendMailRequestqueue: broadcast

queue: persist

Page 8: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Web server broadcasts to clientsClient renders new message

Broadcast Notifications

Page 9: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Multiple ServersAdditional Queues

Broadcast Notifications

Page 10: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Demo: Response Messages

Noticeboard Web App WebSockets & Messaging

Page 11: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Multiple message handlers

Targeted Responses

exchange: noticeboard

SendMailRequest

queue: broadcast

queue: persist

Page 12: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Dedicated reply queueSpecified in outgoing messagesWeb Server listens for replies

Targeted Responses

exchange: noticeboard

SendMailRequest

queue: reply-svr01

Sender: eltonContent: hiReplyTo: reply-svr01

Page 13: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Handlers act on messageSend reply with result

Targeted Responses

SendMailRequest

queue: persist

queue: reply-svr01

MailSavedEvent

HandlerFailedEvent

Page 14: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Handlers act on messageSend reply with result

Targeted Responses

queue: broadcast

queue: reply-svr01

MailBroadcastEvent

HandlerFailedEvent

SendMailRequest

Page 15: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Web server receives replyLooks up client & sends

Targeted Responses

Page 16: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

But... you can do this just with SignalR

Page 17: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Persistence handler offline

Demo: Fault Tolerance

exchange: noticeboard

SendMailRequest

queue: broadcast

queue: persist X

Page 18: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Durable queuesMessages wait for handler

Fault Tolerance

exchange: noticeboard

SendMailRequest

queue: persist

Page 19: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Broadcast notification is easyTargeted response – not so much...

Scaling Concerns

Page 20: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

SignalR fault toleranceHeartbeat checks connection

Scaling Concerns

Page 21: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Connection re-establishedLoad-balanced Web servers

Scaling Concerns

Page 22: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Messages to 'wrong' Reply Queue

Scaling Concerns

queue: reply-svr01 queue: reply-svr02

Page 23: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

Instead of per-server Reply QueueCommon Reply Exchange

Scaling Concerns

Page 24: Messaging Powered Front Ends

Introduction to ServiceInsight for NServiceBusMessaging Powered Front Ends

•You need a channel to the client

•Messaging semantics: pub-sub & req-resp

•Maintain patterns with messaging

•Fault tolerance – persistent messages

•Scaling – broadcast and filter

Summary

Page 25: Messaging Powered Front Ends

Thank you

blog.sixeyed.com

@EltonStoneman