Session for SDN Event.
In this session Mark Taling and I explain how we used NServiceBus and SignalR to publish real time events from a production monitor. After a short intro to NServiceBus and SignalR, we dive into some techniques for combining the two:
1) SignalR for relaying events from the back end to a wide range of clients
2) Using SignalR as a transport for NServiceBus
3) Using NServiceBus as a backplane for scaling out SignalR
10. Where is
“the bus”?
Like Ethernet, it’s
everywhere!
11. 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
12. developers!
developers!
developers!
Very developer
focused
19. Two way, persistent connection, initiated
by client
W3C draft, worked on by IETF
Support (partial) in some browsers
20. 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
21. But I want it now!
Veruca Salt
Willy Wonka & The Chocolate Factory, 1971
22. Other options
long polling
client 1
Got msg? “message” Got msg? “message”
server
POST “message” POST “message”
client 2
forever frame
<iframe src=“/forever”>
client 1 <script> <script>
GET /forever display(“message”); display(“message”);
</script> </script>
server
POST “message” POST “message”
client 2
24. SignalR will abstract away the
actual protocol used, and adds
a couple of layers on top to
make things even easier
SignalR’s layers of abstraction
25. hub
persistent connection
SignalR 1.0 protocols
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
27. 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) server
var chat = $.connection.chatHub; class ChatHub: Hub
… {
chat.server.message(“hi!”); proxy public void message(string text)
… {
chat.client.notify = function(text) Clients.All.notify(text);
{ }
// do something with text }
} dynamic
28.
29. SignalR options
clients
Windows
JavaScript .NET Silverlight WinRT iOS Android
Phone
Service
ASP.NET OWIN Custom SQL Redis
Bus
hosts backplanes
Photo Credit: <a href="http://www.flickr.com/photos/50972268@N00/3960160842/">upton</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by-nd/2.0/">cc</a>
Photo Credit: <a href="http://www.flickr.com/photos/26373139@N08/5547069087/">kenteegardin</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/">cc</a>
Photo Credit: <a href="http://www.flickr.com/photos/38551575@N00/2467222214/">papalars</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by-nd/2.0/">cc</a>
Photo Credit: <a href="http://www.flickr.com/photos/43102195@N08/5240738243/">|| UggBoy♥UggGirl || PHOTO || WORLD || TRAVEL ||</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by/2.0/">cc</a>
Photo Credit: <a href="http://www.flickr.com/photos/58754750@N08/6137200121/">Cast a Line</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by-nd/2.0/">cc</a>Share contract and schema, not class – One of the four Tenets of SOA (Microsoft)
Photo Credit: <a href="http://www.flickr.com/photos/16405999@N00/73014722/">Bruno Girin</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/">cc</a>
Photo by JD Hancockat Flickr.com
Photo byNite_Owl@ Flickr.com
Photo Credit: <a href="http://www.flickr.com/photos/48889107219@N01/1434193709/">debaird™</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/">cc</a>
Photo by JD Hancockat Flickr.com
Photo Credit: <a href="http://www.flickr.com/photos/73645804@N00/8490482069/">woodleywonderworks</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by/2.0/">cc</a>
Photo by JD Hancockat Flickr.com
Photo by JD Hancockat Flickr.com
Photo by JD Hancockat Flickr.com
Photo Credit: <a href="http://www.flickr.com/photos/48080134@N08/4401923926/">Dave Hosford</a> via <a href="http://compfight.com">Compfight</a> <a href="http://creativecommons.org/licenses/by/2.0/">cc</a>