public void DisposeDelivery(AmqpLink link, Delivery delivery, bool settled, DeliveryState state, bool noFlush) { if (link.IsReceiver) { this.incomingChannel.DisposeDelivery(delivery, settled, state, noFlush); } else { this.outgoingChannel.DisposeDelivery(delivery, settled, state, noFlush); } }
protected bool TryCreateRemoteLink(Attach attach, out AmqpLink link) { link = null; if (this.linkFactory == null) { return false; } AmqpLinkSettings linkSettings = AmqpLinkSettings.Create(attach); Exception error = null; try { link = this.LinkFactory.CreateLink(this, linkSettings); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } AmqpException amqpException = exception as AmqpException; if (amqpException != null && amqpException.Error != null && (amqpException.Error.Condition.Equals(AmqpErrorCode.ResourceLimitExceeded) || amqpException.Error.Condition.Equals(AmqpErrorCode.ResourceLocked))) { // out of handle or link name exists throw; } AmqpTrace.Provider.AmqpLogError(this, "CreateLink", exception.Message); // detach requires a handle so the error link has to be attached first link = new ErrorLink(this, linkSettings); error = exception; } link.RemoteHandle = attach.Handle; this.linksByRemoteHandle.Add(attach.Handle.Value, link); if (error != null) { link.SafeClose(error); return false; } return true; }
public void CloseLink(AmqpLink link) { link.SafeClose(); }
public void AttachLink(AmqpLink link) { Fx.Assert(link.Session == this, "The link is not owned by this session."); link.Closed += onLinkClosed; lock (this.ThisLock) { if (this.links.ContainsKey(link.Name)) { throw new AmqpException(AmqpErrorCode.ResourceLocked, AmqpResources.GetString(AmqpResources.AmqpLinkNameInUse, link.Name, this.LocalChannel)); } this.links.Add(link.Name, link); link.LocalHandle = this.linksByLocalHandle.Add(link); } AmqpTrace.Provider.AmqpAttachLink(this.connection, this, link, link.LocalHandle.Value, link.RemoteHandle ?? 0u, link.Name, link.IsReceiver ? "receiver" : "sender", link.Settings.Source, link.Settings.Target); }
public void OnLinkAttached(AmqpLink link) { }
public ActiveClientLink(AmqpLink link, string audience, string endpointUri, string[] requiredClaims, bool isClientToken, DateTime authorizationValidToUtc) : base(link, audience, endpointUri, requiredClaims, isClientToken, authorizationValidToUtc) { this.link = link; }
public LinkConsumer(ConcurrentQueue queue, AmqpLink link) : base(queue) { this.link = link; this.link.ReceivedFlow += LinkReceivedFlow; }
public void CreateClient(AmqpLink link) { int id = Interlocked.Increment(ref this.currentId); if (link.IsReceiver) { Publisher publisher = new Publisher(this, (ReceivingAmqpLink)link, id); lock (this.publishers) { this.publishers.Add(id, publisher); } } else { Consumer consumer = new Consumer(this, (SendingAmqpLink)link, id); lock (this.consumers) { this.consumers.Add(id, consumer); } } }
public ActiveSendReceiveClientLink(AmqpLink link, Uri endpointUri, string audience, string[] requiredClaims, DateTime authorizationValidUntilUtc) : base(link, endpointUri, audience, requiredClaims, authorizationValidUntilUtc) { this.Link = link; }
IAsyncResult ILinkFactory.BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state) => this.OpenLinkAsync(link, timeout).ToAsyncResult(callback, state);
protected virtual void OnLinkCreated(AmqpLink o) { LinkCreated?.Invoke(o, new LinkCreatedEventArgs(o)); }
public IAsyncResult BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state) { return(TaskHelpers.ToAsyncResult(OpenLinkAsync(link, timeout), callback, state)); }
public void OnDelivery(AmqpLink link, Delivery delivery) { }
public void OnLinkClosed(AmqpLink link) { int settledCount = 0; lock (this.syncRoot) { Delivery current = this.firstUnsettled; while (current != null) { Delivery delivery = current; current = current.Next; if (delivery.Link == link) { Delivery.Remove(ref this.firstUnsettled, ref this.lastUnsettled, delivery); settledCount++; } } } if (settledCount > 0) { this.OnWindowMoved(settledCount); } }
public IAsyncResult BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state) { Debug.Fail($"{nameof(AmqpLinkFactory)} open link should not be used."); throw new NotImplementedException(); }
public IAsyncResult BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state) { if (link.IsReceiver && link.Settings.Target is Coordinator) { this.txnManager.AddCoordinator((ReceivingAmqpLink)link); } else { string address = link.IsReceiver ? ((Target)link.Settings.Target).Address.ToString() : ((Source)link.Settings.Source).Address.ToString(); TestQueue queue; if (!this.queues.TryGetValue(address, out queue)) { if (!this.implicitQueue) { throw new AmqpException(AmqpErrorCode.NotFound, string.Format("Node '{0}' not found", address)); } queue = new TestQueue(this); this.queues.Add(address, queue); link.Closed += (s, e) => this.queues.Remove(address); } queue.CreateClient(link); } return new CompletedAsyncResult(callback, state); }
public LinkCreatedEventArgs(AmqpLink link) { Link = link; }
public bool CanAttachLink(AmqpLink newLink, Attach attach) { throw new NotImplementedException(); }