22

Introduction to Windows Azure Service Bus Relay Service

Embed Size (px)

Citation preview

Page 1: Introduction to Windows Azure Service Bus Relay Service
Page 2: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• What is the ServiceBus

• Relay Service

Page 3: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

Page 4: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• IPv4 is running out

– Dynamic DNS

– Network Address Translation (NAT)

• Load Balancers

• Routers

• Hardware Firewall

• Software Firewall

• Web Services simply don’t work

• What about calling back to the client?

* From MSDN Magazine

Page 5: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• People are doing it

– Google Talk

– Skype

• Enters ServiceBus

– Now, you can do it too

• It’s not all about connectivity

– Scalability

– Availability

– Security

Page 6: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Connect everything, anywhere

– Kiosk

– Mobile

• Leverage existing SOA investments with cloud

solutions

• Not all apps move to the cloud

• Names and organizes distributed endpoints

• Provides simple registry

• .NET and WCF integration – skills move forward

– Open and accessible too

• REST, SOAP, RSS, ATOM

Page 7: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

* From MSDN

Page 8: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

Page 9: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Intermediary Pass-Through Service (Push)

– Overcome connectivity challenges

• Uses outbound connections only

– Defaults to TCP with fallback to HTTP

• Relays client calls to service

• Hosted in the cloud

– Scalability

– Security

– Management Portal

* From MSDN

Page 10: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Service connects and authenticates against the relay

– Relay determines how to communicate with the service

• Client authenticates and calls the service

– Relay forwards the message to the service

* From MSDN Magazine

Page 11: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Enables

– Connectivity

– Tunneling

– Eventing

– Push

• Supports

– WS-* specifications

– Message and transport security

Page 12: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Service Bus Address

– [scheme]:[ns].servicebus.windows.net/{uri}

– sb://MyCompany.servicebus.windows.net/CalcService

• Service Bus Registry

– ATOM-based feed of online services

– http://MyCompany.servicebus.windows.net/

• Need to enable publishing to registry

– Add ServiceRegsitrySettings endpoint behavior

configured with public discovery type

Page 13: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

WCF Binding ServiceBus Binding

BasicHttpBinding BasicHttpRelayBinding

WebHttpBinding WebHttpRelayBinding

WSHttpBinding WSHttpRelayBinding

WS2007HttpBinding WS2007HttpRelayBinding

WSHttpContextBinding WSHttpRelayContextBinding

WS2007FederationHttpBinding WS2007FederationHttpRelayBinding

NetTcpBinding NetTcpRelayBinding

NetTcpContextBinding NetTcpRelayContextBinding

N/A NetOnewayRelayBinding

N/A NetEventRelayBinding

Page 14: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Connection Modes

– Direct

– Relayed

– Hybrid

• Requires additional setup of message security

• Promotes to the most direct connection possible

– Intranet / Machine

• Supports duplex

• Best performance and throughput

• .NET parties only

Page 15: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

* From MSDN Magazine

Page 16: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• One-way Relay Binding– Messages are sent to a buffer

– No guarantee of order and delivery

– Disconnected scenarios (not a queue though!)

– One service can read off the queue (Unicast)

• Event Relay Binding– Specialization of the one-way relay binding

– Multiple services can read off the same queue

• Notifications, Traces, Synchronization, …– Fan-out via single-sender-multi-receiver multicast

– Fan-in via multi-sender-single-receiver unicast

Page 17: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

* From MSDN Magazine

Page 18: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

* From MSDN Magazine

Page 19: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Create the namespace and obtain the access key

– Management Portal

Page 20: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Get the Windows Azure ServiceBus NuGet package

var sh = new ServiceHost(typeof(ProblemSolver));

sh.AddServiceEndpoint(typeof (IProblemSolver), new NetTcpBinding(), "net.tcp://localhost:9358/solver");

sh.AddServiceEndpoint(typeof(IProblemSolver), new NetTcpRelayBinding(), ServiceBusEnvironment.CreateServiceUri("sb", "**namespace**", "solver")).Behaviors.Add(new TransportClientEndpointBehavior { TokenProvider =

TokenProvider.CreateSharedSecretTokenProvider( "owner", "**key**")});

sh.Open();

Console.WriteLine("Press ENTER to close");Console.ReadLine();

sh.Close();

Page 21: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved

• Get the Windows Azure ServiceBus NuGet package

var cf = new ChannelFactory<IProblemSolverChannel>(new NetTcpRelayBinding(), new EndpointAddress(ServiceBusEnvironment.CreateServiceUri(

"sb", "**namespace**", "solver")));

cf.Endpoint.Behaviors.Add(new TransportClientEndpointBehavior { TokenProvider =

TokenProvider.CreateSharedSecretTokenProvider("owner","**key**") });

using (var ch = cf.CreateChannel()){

Console.WriteLine(ch.AddNumbers(4, 5));}

Page 22: Introduction to Windows Azure Service Bus Relay Service

© All Rights Reserved