bool IContainer.AttachLink(ListenerConnection connection, ListenerSession session, Link link, Attach attach) { Source source = attach.Source as Source; Target target = attach.Target as Target; bool dynamic = false; string address = null; if (attach.Role) { address = source.Address; dynamic = source.Dynamic; } else { if (target != null) { address = target.Address; dynamic = target.Dynamic; } else if (attach.Target is Coordinator) { this.txnManager.AddCoordinator((ListenerLink)link); return(true); } } if (dynamic) { address = string.Format("$dynamic.{0}", Interlocked.Increment(ref this.dynamidId)); if (attach.Role) { source.Dynamic = false; source.Address = address; } else { target.Address = address; target.Dynamic = false; } } TestQueue queue; lock (this.queues) { if (!this.queues.TryGetValue(address, out queue)) { if (dynamic || (this.implicitQueue && !link.Name.StartsWith("$explicit:"))) { queue = new TestQueue(this); this.queues.Add(address, queue); connection.Closed += (o, e) => this.RemoveQueue(address); } else { throw new AmqpException(ErrorCode.NotFound, string.Format("Node '{0}' not found", address)); } } } if (attach.Role) { queue.CreateConsumer((ListenerLink)link); } else { queue.CreatePublisher((ListenerLink)link); } return(true); }
bool IContainer.AttachLink(ListenerConnection connection, ListenerSession session, Link link, Attach attach) { Source source = attach.Source as Source; Target target = attach.Target as Target; bool dynamic = false; string address = null; if (attach.Role) { address = source.Address; dynamic = source.Dynamic; } else { if (target != null) { address = target.Address; dynamic = target.Dynamic; } else if (attach.Target is Coordinator) { this.txnManager.AddCoordinator((ListenerLink)link); return true; } } if (dynamic) { address = string.Format("$dynamic.{0}", Interlocked.Increment(ref this.dynamidId)); if (attach.Role) { source.Dynamic = false; source.Address = address; } else { target.Address = address; target.Dynamic = false; } } TestQueue queue; lock (this.queues) { if (!this.queues.TryGetValue(address, out queue)) { if (dynamic || this.implicitQueue) { queue = new TestQueue(this); this.queues.Add(address, queue); connection.Closed += (o, e) => this.RemoveQueue(address); } else { throw new AmqpException(ErrorCode.NotFound, string.Format("Node '{0}' not found", address)); } } } if (attach.Role) { queue.CreateConsumer((ListenerLink)link); } else { queue.CreatePublisher((ListenerLink)link); } return true; }
Link IContainer.CreateLink(ListenerConnection connection, ListenerSession session, Attach attach) { return(new ListenerLink(session, attach)); }
Link IContainer.CreateLink(ListenerConnection connection, ListenerSession session, Attach attach) { return new ListenerLink(session, attach); }