public void AttachLink(AmqpLink link) { Fx.Assert(link.Session == this, "The link is not owned by this session."); link.Closed += new EventHandler(this.OnLinkClosed); lock (this.ThisLock) { this.links.Add(link.Name, link); link.LocalHandle = this.linksByLocalHandle.Add(link); } Utils.Trace(TraceLevel.Info, "{0}: Attach {1} '{2}' ({3})", this, link, link.Name, link.IsReceiver ? "receiver" : "sender"); }
protected override void OnSignal(AmqpLink link) { }
public OpenLinkAsyncResult(Listener listener, AmqpLink link, AsyncCallback callback, object state) : base(callback, state) { this.Link = link; string node = link.IsReceiver ? ((Target)link.Settings.Target).Address.ToString() : ((Source)link.Settings.Source).Address.ToString(); LinkAsyncResult result = null; if (listener.TryMatchLink(node, false, link.IsReceiver, (r) => { return this; }, out result)) { result.Signal(link); this.Complete(true); } }
protected override void OnSignal(AmqpLink link) { Fx.Assert(link != null, "Accept cannot be completed with a null link"); this.Link = link; if (this.isReceiver) { ((ReceivingAmqpLink)link).RegisterMessageListener(this.messageListener); } }
protected abstract void OnSignal(AmqpLink link);
public void Signal(AmqpLink link) { this.OnSignal(link); this.Complete(false); }
IAsyncResult ILinkFactory.BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state) { return new OpenLinkAsyncResult(this, link, callback, state); }
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 IAsyncResult OnBeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state);
IAsyncResult Microsoft.ServiceBus.Messaging.Amqp.ILinkFactory.BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state) { return(this.OnBeginOpenLink(link, timeout, callback, state)); }
bool TryCreateRemoteLink(Attach attach, out AmqpLink link) { link = null; AmqpLinkSettings linkSettings = AmqpLinkSettings.Create(attach); try { link = this.linkFactory.CreateLink(this, linkSettings); link.RemoteHandle = attach.Handle; this.linksByRemoteHandle.Add(attach.Handle.Value, link); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } attach.Source = null; attach.Target = null; this.SendCommand(attach); if (link != null) { link.TryClose(exception); } return false; } return true; }
public void DisposeDelivery(AmqpLink link, Delivery delivery, bool settled, DeliveryState state) { if (link.IsReceiver) { this.incomingChannel.DisposeDelivery(delivery, settled, state); } else { this.outgoingChannel.DisposeDelivery(delivery, settled, state); } }
public void OnReceiveTransfer(AmqpLink link, Transfer transfer) { if (!transferEverReceived) { this.OnReceiveFirstTransfer(transfer); this.transferEverReceived = true; } lock (this.SyncRoot) { if (this.incomingWindow == 0) { Utils.Trace(TraceLevel.Verbose, "{0}: Window closed", this); throw new AmqpException(AmqpError.WindowViolation); } this.nextIncomingId.Increment(); --this.incomingWindow; } this.pendingTransfers.DoWork(new Tuple<AmqpLink, Transfer>(link, transfer)); }