Introduction to Windows Azure Service Bus Relay Service
-
Upload
tamir-dresher -
Category
Social Media
-
view
1.330 -
download
3
Transcript of Introduction to Windows Azure Service Bus Relay Service
© All Rights Reserved
• What is the ServiceBus
• Relay Service
© All Rights Reserved
© 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
© 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
© 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
© All Rights Reserved
© 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
© 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
© All Rights Reserved
• Enables
– Connectivity
– Tunneling
– Eventing
– Push
• Supports
– WS-* specifications
– Message and transport security
© 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
© 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
© 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
© 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
© All Rights Reserved
• Create the namespace and obtain the access key
– Management Portal
© 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();
© 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));}
© All Rights Reserved