protected AmqpLink(AmqpSession session, AmqpLinkSettings linkSettings) { if (linkSettings == null) { throw new ArgumentNullException("linkSettings"); } this.Session = session; this.settings = linkSettings; this.linkCredit = this.settings.TransferLimit; this.settings.AutoSendFlow = this.linkCredit > 0; this.syncRoot = new object(); Source source = (Source)this.settings.Source; if (source != null) { this.defaultOutcome = source.DefaultOutcome; } if (this.defaultOutcome == null) { this.defaultOutcome = AmqpConstants.ReleasedOutcome; } this.unsettledMap = new Dictionary<ArraySegment<byte>, Delivery>(ByteArrayComparer.Instance); this.pendingDeliveries = new SerializedWorker<Delivery>(this.TrySendDelivery, this.AbortDelivery, false); session.AttachLink(this); }
protected override AmqpLink CreateLink(AmqpSession session) { AmqpLinkSettings settings = new AmqpLinkSettings(); settings.LinkName = Guid.NewGuid().ToString("N"); settings.Target = new Target() { Address = this.Node }; settings.Role = false; settings.SettleType = SettleMode.SettleOnSend; return new SendingAmqpLink(session, settings); }
public OpenTerminusAsyncResult(Terminus parent, AsyncCallback callback, object state) : base(callback, state) { this.parent = parent; this.onObjectOpen = this.OnObjectOpen; this.parent.container.EnsureConnectionOpen(); this.session = this.parent.container.connection.CreateSession(new AmqpSessionSettings()); this.link = this.parent.CreateLink(this.session); this.session.BeginOpen(TimeSpan.MaxValue, this.onObjectOpen, this.session); this.link.BeginOpen(TimeSpan.MaxValue, this.onObjectOpen, this.link); }
protected abstract AmqpLink CreateLink(AmqpSession session);
public SendingAmqpLink(AmqpSession session, AmqpLinkSettings settings) : base(session, settings) { }
public IncomingSessionChannel(AmqpSession session) : base(session, session.settings.IncomingBufferSize) { this.name = session.ToString() + "(in)"; this.pendingTransfers = new SerializedWorker<Tuple<AmqpLink, Transfer>>(this.OnTransfer, null, false); this.incomingWindow = session.settings.IncomingWindow(); this.flowThreshold = this.incomingWindow == uint.MaxValue ? uint.MaxValue : this.incomingWindow * 2 / 3; this.IsReceiver = true; }
void AddSession(AmqpSession session, ushort? channel) { session.Closed += new EventHandler(this.OnSessionClosed); lock (this.ThisLock) { session.LocalChannel = (ushort)this.sessionsByLocalHandle.Add(session); if (channel != null) { this.sessionsByRemoteHandle.Add(channel.Value, session); } } Utils.Trace(TraceLevel.Info, "{0}: Added {1} (local={2} remote={3})", this, session, session.LocalChannel, channel); }
AmqpLink Microsoft.ServiceBus.Messaging.Amqp.ILinkFactory.CreateLink(AmqpSession session, AmqpLinkSettings linkSettings) { throw Fx.AssertAndThrow("AmqpTransportManager should always create the Link!"); }
public ReceivingAmqpLink(AmqpSession session, AmqpLinkSettings settings) : base(session, settings) { this.minTimeout = InitialTimeout; this.syncRoot = new object(); }
public SendingAmqpLink(AmqpSession session, AmqpLinkSettings settings) : base(session, settings) { this.pendingDeliveries = new SerializedWorker <AmqpMessage>(this); this.inflightSends = new WorkCollection <ArraySegment <byte>, SendingAmqpLink.SendAsyncResult, Outcome>(ByteArrayComparer.Instance); this.lastFlowRequestTime = DateTime.UtcNow; }
public OutgoingSessionChannel(AmqpSession session) : base(session, session.settings.OutgoingBufferSize) { this.name = session.ToString() + "(out)"; this.maxFrameSize = session.connection.Settings.MaxFrameSize(); this.onSettledDeliveryComplete = this.OnSettledDeliveryComplete; this.inflightDeliveries = new SerializedWorker<Delivery>(this.OnSendDelivery, null, false); this.nextOutgoingId = session.settings.NextOutgoingId.Value; this.outgoingWindow = session.settings.OutgoingWindow.Value; this.remoteIncomingWindow = session.settings.OutgoingWindow.Value; this.IsReceiver = false; }
public SessionChannel(AmqpSession session, int bufferSize) { this.session = session; this.nextDeliveryId = session.settings.InitialDeliveryId; this.unsettledLwm = this.nextDeliveryId; this.deliveryBuffer = new Delivery[Math.Min(bufferSize, SessionChannel.MaxBuferSize)]; this.dispositionTimer = new IOThreadTimer(DispositionTimerCallback, this, false); this.syncRoot = new object(); int defaultThreshold = this.deliveryBuffer.Length * 2 / 3; this.dispositionThreshold = session.settings.DispositionThreshold == 0 ? defaultThreshold : Math.Min(session.settings.DispositionThreshold, defaultThreshold); Utils.Trace(TraceLevel.Verbose, "{0}: buffer-size:{1}, disposition-threshold:{2}.", this, this.deliveryBuffer.Length, this.dispositionThreshold); }
protected override AmqpLink CreateLink(AmqpSession session) { AmqpLinkSettings settings = new AmqpLinkSettings(); settings.LinkName = Guid.NewGuid().ToString("N"); settings.Source = new Source() { Address = this.Node }; settings.Role = true; ReceivingAmqpLink link = new ReceivingAmqpLink(session, settings); link.RegisterMessageListener(this.OnMessage); return link; }
AmqpLink ILinkFactory.CreateLink(AmqpSession session, AmqpLinkSettings settings) { bool isReceiver = settings.Role.Value; if (isReceiver) { settings.TransferLimit = uint.MaxValue; return new ReceivingAmqpLink(session, settings); } else { return new SendingAmqpLink(session, settings); } }
public IncomingSessionChannel(AmqpSession session) : base(session) { this.incomingWindow = session.settings.IncomingWindow(); this.flowThreshold = this.incomingWindow * 2 / 3; base.IsReceiver = true; }
public OutgoingSessionChannel(AmqpSession session) : base(session) { this.nextOutgoingId = session.settings.NextOutgoingId.Value; this.outgoingWindow = session.settings.OutgoingWindow.Value; base.IsReceiver = false; }