예제 #1
0
        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);
        }
예제 #2
0
        public static AmqpLinkSettings Create(Attach attach)
        {
            AmqpLinkSettings settings = new AmqpLinkSettings();
            settings.LinkName = attach.LinkName;
            settings.Role = !attach.Role.Value;
            settings.Source = attach.Source;
            settings.Target = attach.Target;
            settings.SndSettleMode = attach.SndSettleMode;
            settings.RcvSettleMode = attach.RcvSettleMode;
            settings.MaxMessageSize = attach.MaxMessageSize;
            settings.Properties = attach.Properties;
            if (settings.Role.Value)
            {
                settings.TransferLimit = AmqpConstants.DefaultLinkCredit;
            }
            else
            {
                settings.InitialDeliveryCount = 0;
            }

            return settings;
        }
예제 #3
0
 public ReceivingAmqpLink(AmqpSession session, AmqpLinkSettings settings) :
     base(session, settings)
 {
     this.minTimeout = InitialTimeout;
     this.syncRoot = new object();
 }
예제 #4
0
 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);
     }
 }
예제 #5
0
 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;
 }
예제 #6
0
 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);
 }
예제 #7
0
 public SendingAmqpLink(AmqpSession session, AmqpLinkSettings settings)
     : base(session, settings)
 {
 }