コード例 #1
0
ファイル: AmqpSession.cs プロジェクト: modulexcite/IL2JS
        public void AttachLink(AmqpLink link)
        {
            Fx.Assert(link.Session == this, "The link is not owned by this session.");
            link.Closed += new EventHandler(this.OnLinkClosed);

            lock (this.ThisLock)
            {
                this.links.Add(link.Name, link);
                link.LocalHandle = this.linksByLocalHandle.Add(link);
            }

            Utils.Trace(TraceLevel.Info, "{0}: Attach {1} '{2}' ({3})", this, link, link.Name, link.IsReceiver ? "receiver" : "sender");
        }
コード例 #2
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 protected override void OnSignal(AmqpLink link)
 {
 }
コード例 #3
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
                public OpenLinkAsyncResult(Listener listener, AmqpLink link, AsyncCallback callback, object state)
                    : base(callback, state)
                {
                    this.Link = link;

                    string node = link.IsReceiver ? ((Target)link.Settings.Target).Address.ToString() : ((Source)link.Settings.Source).Address.ToString();
                    LinkAsyncResult result = null;
                    if (listener.TryMatchLink(node, false, link.IsReceiver, (r) => { return this; }, out result))
                    {
                        result.Signal(link);

                        this.Complete(true);
                    }
                }
コード例 #4
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 protected override void OnSignal(AmqpLink link)
 {
     Fx.Assert(link != null, "Accept cannot be completed with a null link");
     this.Link = link;
     if (this.isReceiver)
     {
         ((ReceivingAmqpLink)link).RegisterMessageListener(this.messageListener);
     }
 }
コード例 #5
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 protected abstract void OnSignal(AmqpLink link);
コード例 #6
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 public void Signal(AmqpLink link)
 {
     this.OnSignal(link);
     this.Complete(false);
 }
コード例 #7
0
ファイル: Container.cs プロジェクト: modulexcite/IL2JS
 IAsyncResult ILinkFactory.BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state)
 {
     return new OpenLinkAsyncResult(this, link, callback, state);
 }
コード例 #8
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);
                }
コード例 #9
0
 protected abstract IAsyncResult OnBeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state);
コード例 #10
0
 IAsyncResult Microsoft.ServiceBus.Messaging.Amqp.ILinkFactory.BeginOpenLink(AmqpLink link, TimeSpan timeout, AsyncCallback callback, object state)
 {
     return(this.OnBeginOpenLink(link, timeout, callback, state));
 }
コード例 #11
0
ファイル: AmqpSession.cs プロジェクト: modulexcite/IL2JS
        bool TryCreateRemoteLink(Attach attach, out AmqpLink link)
        {
            link = null;
            AmqpLinkSettings linkSettings = AmqpLinkSettings.Create(attach);

            try
            {
                link = this.linkFactory.CreateLink(this, linkSettings);
                link.RemoteHandle = attach.Handle;
                this.linksByRemoteHandle.Add(attach.Handle.Value, link);
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }

                attach.Source = null;
                attach.Target = null;
                this.SendCommand(attach);

                if (link != null)
                {
                    link.TryClose(exception);
                }

                return false;
            }

            return true;
        }
コード例 #12
0
ファイル: AmqpSession.cs プロジェクト: modulexcite/IL2JS
 public void DisposeDelivery(AmqpLink link, Delivery delivery, bool settled, DeliveryState state)
 {
     if (link.IsReceiver)
     {
         this.incomingChannel.DisposeDelivery(delivery, settled, state);
     }
     else
     {
         this.outgoingChannel.DisposeDelivery(delivery, settled, state);
     }
 }
コード例 #13
0
ファイル: AmqpSession.cs プロジェクト: modulexcite/IL2JS
            public void OnReceiveTransfer(AmqpLink link, Transfer transfer)
            {
                if (!transferEverReceived)
                {
                    this.OnReceiveFirstTransfer(transfer);
                    this.transferEverReceived = true;
                }

                lock (this.SyncRoot)
                {
                    if (this.incomingWindow == 0)
                    {
                        Utils.Trace(TraceLevel.Verbose, "{0}: Window closed", this);
                        throw new AmqpException(AmqpError.WindowViolation);
                    }

                    this.nextIncomingId.Increment();
                    --this.incomingWindow;
                }

                this.pendingTransfers.DoWork(new Tuple<AmqpLink, Transfer>(link, transfer));
            }