async Task <ReceivingAmqpLink> CreateLinkAsync(TimeSpan timeout) { FilterSet filterMap = null; MessagingEventSource.Log.AmqpReceiveLinkCreateStart(this.ClientId, false, this.EntityType, this.Path); if (this.isSessionReceiver) { filterMap = new FilterSet { { AmqpClientConstants.SessionFilterName, this.sessionId } }; } AmqpLinkSettings linkSettings = new AmqpLinkSettings { Role = true, TotalLinkCredit = (uint)this.PrefetchCount, AutoSendFlow = this.PrefetchCount > 0, Source = new Source { Address = this.Path, FilterSet = filterMap }, SettleType = (this.ReceiveMode == ReceiveMode.PeekLock) ? SettleMode.SettleOnDispose : SettleMode.SettleOnSend }; linkSettings.AddProperty(AmqpClientConstants.EntityTypeName, (int)this.EntityType); linkSettings.AddProperty(AmqpClientConstants.TimeoutName, (uint)timeout.TotalMilliseconds); AmqpSendReceiveLinkCreator sendReceiveLinkCreator = new AmqpSendReceiveLinkCreator(this.Path, this.ServiceBusConnection, new[] { ClaimConstants.Listen }, this.CbsTokenProvider, linkSettings); ReceivingAmqpLink receivingAmqpLink = (ReceivingAmqpLink)await sendReceiveLinkCreator.CreateAndOpenAmqpLinkAsync().ConfigureAwait(false); MessagingEventSource.Log.AmqpReceiveLinkCreateStop(this.ClientId); return(receivingAmqpLink); }
async Task <SendingAmqpLink> CreateLinkAsync(TimeSpan timeout) { MessagingEventSource.Log.AmqpSendLinkCreateStart(this.ClientId, this.EntityType, this.Path); AmqpLinkSettings linkSettings = new AmqpLinkSettings { Role = false, InitialDeliveryCount = 0, Target = new Target { Address = this.Path }, Source = new Source { Address = this.ClientId }, }; if (this.EntityType != null) { linkSettings.AddProperty(AmqpClientConstants.EntityTypeName, (int)this.EntityType); } AmqpSendReceiveLinkCreator sendReceiveLinkCreator = new AmqpSendReceiveLinkCreator(this.Path, this.ServiceBusConnection, new[] { ClaimConstants.Send }, this.CbsTokenProvider, linkSettings); SendingAmqpLink sendingAmqpLink = (SendingAmqpLink)await sendReceiveLinkCreator.CreateAndOpenAmqpLinkAsync().ConfigureAwait(false); MessagingEventSource.Log.AmqpSendLinkCreateStop(this.ClientId); return(sendingAmqpLink); }