Example #1
0
        /// <summary>
        /// Initializes the link object.
        /// </summary>
        /// <param name="type">A prefix to the link name for debugging purposes.</param>
        /// <param name="session">The session in which the link is created.</param>
        /// <param name="linkSettings">The link settings.</param>
        protected AmqpLink(string type, AmqpSession session, AmqpLinkSettings linkSettings)
            : base(type)
        {
            this.references = 1;
            this.syncRoot   = new object();
            this.settings   = linkSettings ?? throw new ArgumentNullException(nameof(linkSettings));
            this.linkCredit = this.settings.TotalLinkCredit;

            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);
            if (session != null)
            {
                this.AttachTo(session);
            }

            if (!linkSettings.IsReceiver())
            {
                this.inflightDeliveries = new SerializedWorker <Delivery>(this);
            }
        }
Example #2
0
            AmqpLink ILinkFactory.CreateLink(AmqpSession session, AmqpLinkSettings settings)
            {
                AmqpLink link;

                if (settings.IsReceiver())
                {
                    link = new ReceivingAmqpLink(session, settings);
                }
                else
                {
                    link = new SendingAmqpLink(session, settings);
                }

                AmqpTrace.Provider.AmqpLogOperationInformational(this, TraceOperation.Create, link);
                return(link);
            }