SALES: 1-800-867-1380

NamespaceManager.CreateRelayAsync Method

Asynchronously creates a new persistent relay within the service namespace.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method CreateRelayAsync(RelayDescription) Asynchronously creates a new relay in the service namespace with the specified queue description.
Public method CreateRelayAsync(String, RelayType) Asynchronously creates a new queue in the service namespace with the given path and type.

A persistent relay (with the RelayDescription.IsDynamic property set to false) is a relay endpoint explicitly created by calling CreateRelayAsync(). Even when there are no listeners connected, that endpoint is known to the Service Bus relay runtime. This feature gives the relay a place to store endpoint-specific SAS rules.

The following example creates a persistent relay with one listen rule and one send rule (the key values are generated automatically by the SharedAccessAuthorizationRule constructor.

var namespaceManager = NamespaceManager.CreateFromConnectionString(rootConnectionString);
var description = new RelayDescription(endpointPath, RelayType.NetTcp);
var listenRule = new SharedAccessAuthorizationRule("MyListenKey", new List<AccessRights> { AccessRights.Listen });
var sendRule = new SharedAccessAuthorizationRule("MySendKey", new List<AccessRights> { AccessRights.Send });
description = namespaceManager.CreateRelayAsync(description).Result;
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft