Slide 1

Slide 1 text

Real Time Event Feeds with NServiceBus and SignalR #SIGNALR #NSERVICEBUS #SDE @roycornelissen @marktaling

Slide 2

Slide 2 text

NServiceBus Combining the two SignalR Demos Introduction

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Showcase: real time monitor gateway production monitor

Slide 5

Slide 5 text

[connect] monitor service Plugins gateway SendAvailablePlugins Powered By PluginAvailable (3x) Showcase: real time monitor

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

NServiceBus A service bus is an architectural style for integration To simplify communication between services in a distributed system

Slide 9

Slide 9 text

Loose coupling Share contract and schema, not class Temporal decoupling through queued messaging

Slide 10

Slide 10 text

Where is “the bus”? Like Ethernet, it’s everywhere!

Slide 11

Slide 11 text

A .NET framework to help implement SOA with the Service Bus architectural style Abstracts away transport, threading, queues, transactions Focuses on implementing business logic Highly pluggable

Slide 12

Slide 12 text

developers! developers! developers! Very developer focused

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

http has a pull model

Slide 17

Slide 17 text

The push concept The server takes the initiative to send data to the client

Slide 18

Slide 18 text

Push protocols irc smtp websocket server sent events

Slide 19

Slide 19 text

Two way, persistent connection, initiated by client W3C draft, worked on by IETF Support (partial) in some browsers

Slide 20

Slide 20 text

Server side events “Pub/Sub” like protocol over http Also still a W3C draft One-way, client needs extra channel for send Proxies need to know about content-type:text/event-stream

Slide 21

Slide 21 text

But I want it now! Veruca Salt Willy Wonka & The Chocolate Factory, 1971

Slide 22

Slide 22 text

Other options client 2 server POST “message” client 1 Got msg? “message” long polling POST “message” Got msg? “message” client 2 server POST “message” client 1 GET /forever display(“message”); forever frame POST “message” display(“message”);

Slide 23

Slide 23 text

SignalR to the rescue

Slide 24

Slide 24 text

SignalR’s layers of abstraction SignalR will abstract away the actual protocol used, and adds a couple of layers on top to make things even easier

Slide 25

Slide 25 text

protocols persistent connection hub web sockets server events long polling forever frame • Unified programming model • Deals with connectivity issues (connection slow, reconnect, disconnects) • Available for multiple types of clients • Messaging bus • Utilizes Json.NET for serialization SignalR 1.0

Slide 26

Slide 26 text


Slide 27

Slide 27 text

Client/server boundaries fade Hubs let you provide a semantic API between client and server SignalR creates a proxy between the two parties client (javascript) var chat = $.connection.chatHub; … chat.server.message(“hi!”); … chat.client.notify = function(text) { // do something with text } server class ChatHub: Hub { public void message(string text) { Clients.All.notify(text); } } proxy dynamic

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

SignalR options JavaScript .NET Windows Phone Silverlight WinRT iOS Android ASP.NET OWIN Custom SQL Redis Service Bus clients hosts backplanes

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Gateway Monitor Service Gateway IIS AppFabric input queue input queue MonitorHub: Hub NServiceBus MessageForwarder: IHandleMessages GlobalHost .ConnectionManager .GetHubContext();.

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Transport Monitor Service Gateway IIS AppFabric SignalR NServiceBus input queue input queue MonitorHub: Hub NServiceBus

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

Transparent: no notion of SignalR NServiceBus in the client SignalR transport The Good

Slide 36

Slide 36 text

No guaranteed delivery No transaction support SignalR transport The Bad

Slide 37

Slide 37 text

Scaling out SignalR via backplanes B NServiceBus ?

Slide 38

Slide 38 text

An NServiceBus backplane Backplane Service SignalR IIS AppFabric input queue NServiceBusMessageBus: ScaleoutMessageBus NServiceBus Receiver: IHandleMessages Bus.Send() MessageDispatcher: IHandleMessages Bus.Publish() OnReceived(…);. input queue

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Reliability offered by NServiceBus What about scalability of the backplane service itself? SignalR backplane Considerations

Slide 41

Slide 41 text


Slide 42

Slide 42 text

@roycornelissen [email protected] thanks! @marktaling [email protected]