Techbubbles

The .NET Service Bus With Example

You need to open an account with the .NET Service Bus, and need to use the .NET Service Bus administration Web site to create a new solution. You can open an account by visiting the following link http://portal.ex.azure.microsoft.com/. More about The .NET Service Bus can be found here.

AzureService

Create a solution with the .NET Service Bus as shown above. Here the solution is equivalent to the machine or domain name in regular network. Like WCF service, Every relayed service must have a unique address. The format of the address is always a base address followed by number of optional URIs:

[base address]/[optional URI]/…./[optional URI]

The format of the base address is

[schema]://[solution]/[service bus address]

The service bus address is:

servicebus.windows.net

http://MySolution/servicebus.windows.net/MySolution

Once your service connects to the relay service and starts listening on its address no other service can listen under your URI.

The Service Bus Bindings

The .NET Service Bus offering the following bindings for relaying messages

  • TCP relay binding
  • WS relay binding
  • The one-way relay binding
  • Event relay binding

The TCP relay binding is majority choice. It yields the best performance and throughput. It supports request-replay operations, one-way operations and even duplex call backs.

The TCP relay always uses sb:

<endpoint

   address = “sb://MySolution/Servicebus.Windows.net/….”

   binding=”netTcpRelayBinding”

   contract=”….”

/>  

TCP relay binding Features

The TCP relay binding requires TCP port 808 to open for calls out. The TCP relaying offers unlimited message size. It always maintains a transport session. TCP relay offers three connection modes relayed, direct and hybrid.

Relayed connection is the default mode of the TCP relay binding.

TCP relay direct mode

Relay-Direct

  1. The service first connects to the relay service and authenticated itself.
  2. The client connects and authenticates itself.
  3. The relay service promotes the direct connection between client and service by telling the client how to reach the service.
  4. Then client can call the service directly.

Related Posts:

%d bloggers like this: