コード例 #1
0
ファイル: AmqpLink.cs プロジェクト: modulexcite/IL2JS
        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
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 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);
 }
コード例 #3
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
                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);
                }
コード例 #4
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 protected abstract AmqpLink CreateLink(AmqpSession session);
コード例 #5
0
ファイル: Container.cs プロジェクト: tralivali1234/IL2JS
 protected abstract AmqpLink CreateLink(AmqpSession session);
コード例 #6
0
 public SendingAmqpLink(AmqpSession session, AmqpLinkSettings settings)
     : base(session, settings)
 {
 }
コード例 #7
0
ファイル: AmqpSession.cs プロジェクト: modulexcite/IL2JS
 public IncomingSessionChannel(AmqpSession session)
     : base(session, session.settings.IncomingBufferSize)
 {
     this.name = session.ToString() + "(in)";
     this.pendingTransfers = new SerializedWorker<Tuple<AmqpLink, Transfer>>(this.OnTransfer, null, false);
     this.incomingWindow = session.settings.IncomingWindow();
     this.flowThreshold = this.incomingWindow == uint.MaxValue ? uint.MaxValue : this.incomingWindow * 2 / 3;
     this.IsReceiver = true;
 }
コード例 #8
0
ファイル: AmqpConnection.cs プロジェクト: modulexcite/IL2JS
        void AddSession(AmqpSession session, ushort? channel)
        {
            session.Closed += new EventHandler(this.OnSessionClosed);
            lock (this.ThisLock)
            {
                session.LocalChannel = (ushort)this.sessionsByLocalHandle.Add(session);
                if (channel != null)
                {
                    this.sessionsByRemoteHandle.Add(channel.Value, session);
                }
            }

            Utils.Trace(TraceLevel.Info, "{0}: Added {1} (local={2} remote={3})", this, session, session.LocalChannel, channel);
        }
コード例 #9
0
 AmqpLink Microsoft.ServiceBus.Messaging.Amqp.ILinkFactory.CreateLink(AmqpSession session, AmqpLinkSettings linkSettings)
 {
     throw Fx.AssertAndThrow("AmqpTransportManager should always create the Link!");
 }
コード例 #10
0
 public ReceivingAmqpLink(AmqpSession session, AmqpLinkSettings settings) :
     base(session, settings)
 {
     this.minTimeout = InitialTimeout;
     this.syncRoot   = new object();
 }
コード例 #11
0
 public SendingAmqpLink(AmqpSession session, AmqpLinkSettings settings) : base(session, settings)
 {
     this.pendingDeliveries   = new SerializedWorker <AmqpMessage>(this);
     this.inflightSends       = new WorkCollection <ArraySegment <byte>, SendingAmqpLink.SendAsyncResult, Outcome>(ByteArrayComparer.Instance);
     this.lastFlowRequestTime = DateTime.UtcNow;
 }
コード例 #12
0
ファイル: SendingAmqpLink.cs プロジェクト: modulexcite/IL2JS
 public SendingAmqpLink(AmqpSession session, AmqpLinkSettings settings)
     : base(session, settings)
 {
 }
コード例 #13
0
ファイル: AmqpSession.cs プロジェクト: modulexcite/IL2JS
 public OutgoingSessionChannel(AmqpSession session)
     : base(session, session.settings.OutgoingBufferSize)
 {
     this.name = session.ToString() + "(out)";
     this.maxFrameSize = session.connection.Settings.MaxFrameSize();
     this.onSettledDeliveryComplete = this.OnSettledDeliveryComplete;
     this.inflightDeliveries = new SerializedWorker<Delivery>(this.OnSendDelivery, null, false);
     this.nextOutgoingId = session.settings.NextOutgoingId.Value;
     this.outgoingWindow = session.settings.OutgoingWindow.Value;
     this.remoteIncomingWindow = session.settings.OutgoingWindow.Value;
     this.IsReceiver = false;
 }
コード例 #14
0
ファイル: AmqpSession.cs プロジェクト: modulexcite/IL2JS
            public SessionChannel(AmqpSession session, int bufferSize)
            {
                this.session = session;
                this.nextDeliveryId = session.settings.InitialDeliveryId;
                this.unsettledLwm = this.nextDeliveryId;
                this.deliveryBuffer = new Delivery[Math.Min(bufferSize, SessionChannel.MaxBuferSize)];
                this.dispositionTimer = new IOThreadTimer(DispositionTimerCallback, this, false);
                this.syncRoot = new object();

                int defaultThreshold = this.deliveryBuffer.Length * 2 / 3;
                this.dispositionThreshold = session.settings.DispositionThreshold == 0 ? defaultThreshold : Math.Min(session.settings.DispositionThreshold, defaultThreshold);
                Utils.Trace(TraceLevel.Verbose, "{0}: buffer-size:{1}, disposition-threshold:{2}.", this, this.deliveryBuffer.Length, this.dispositionThreshold);
            }
コード例 #15
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 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;
 }
コード例 #16
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 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);
     }
 }
コード例 #17
0
 public IncomingSessionChannel(AmqpSession session) : base(session)
 {
     this.incomingWindow = session.settings.IncomingWindow();
     this.flowThreshold  = this.incomingWindow * 2 / 3;
     base.IsReceiver     = true;
 }
コード例 #18
0
 public ReceivingAmqpLink(AmqpSession session, AmqpLinkSettings settings) :
     base(session, settings)
 {
     this.minTimeout = InitialTimeout;
     this.syncRoot = new object();
 }
コード例 #19
0
 public OutgoingSessionChannel(AmqpSession session) : base(session)
 {
     this.nextOutgoingId = session.settings.NextOutgoingId.Value;
     this.outgoingWindow = session.settings.OutgoingWindow.Value;
     base.IsReceiver     = false;
 }