Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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;

Community Additions

© 2015 Microsoft