Share via


RouterClient Class

[This is prerelease documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Creates a ChannelFactory to communicate over the Router.

Namespace: Microsoft.ServiceBus
Assembly: Microsoft.ServiceBus (in microsoft.servicebus.dll)

Usage

    Dim instance As RouterClient

Syntax

'Declaration
Public NotInheritable Class RouterClient
public sealed class RouterClient
public ref class RouterClient sealed
public final class RouterClient
public final class RouterClient

Example

The following sample shows the creation of a Router Client using a static method:

        static RouterClient GetOrCreateRouter(TransportClientEndpointBehavior serviceBusCredential, Uri routerUri, ref RouterPolicy routerPolicy)
        {
            RouterClient client;

//Check to see if a Router already exists at the URI specified
            try
            {
                client = RouterManagementClient.GetRouter(serviceBusCredential, routerUri);
                routerPolicy = client.GetPolicy();
                return client;
            }
            catch (EndpointNotFoundException)
            {
                // Not found; absorb and make a new router below. 
                // Other exceptions get bubbled up.
            }
            client = RouterManagementClient.CreateRouter(serviceBusCredential, routerUri, routerPolicy);
            routerPolicy = client.GetPolicy();
            return client;
        }


Using a Router Client

In the following partial example we can use the Router Client to create a Channel Factory

                ChannelFactory<IOnewayChannel> onewayChannelFactory = routerClient.CreateRouterClient<IOnewayChannel>();

Remarks

The .NET Service Bus supports only Full Trust code access security.

A RouterClient client is constructed using the RouterManagementClient.CreateRoute() static method.

Inheritance Hierarchy

System.Object
  Microsoft.ServiceBus.RouterClient

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008, and Windows 2000

Target Platforms

See Also

Reference

RouterClient Members
Microsoft.ServiceBus Namespace