Beispiel #1
0
        //protected override IQueueAck Send(QueueItem message)
        //{
        //    return _api.PublishItem(message);
        //}


        protected override void ReceiveAsync(IDynamicWait dw)
        {
            QueueRequest request = new QueueRequest()
            {
                Host       = _api.QueueName,
                QCommand   = QueueCmd.Dequeue,
                DuplexType = DuplexTypes.WaitOne
            };

            //void OnNack()
            //{
            //    CalcDynamicWait(false);
            //}

            //void OnAck(bool ack)
            //{
            //    aw.DynamicWaitAck(ack);
            //}

            //if (EnableResetEvent)
            //    _api.DequeueAsync(request, ConnectTimeout, OnCompleted, OnAck, resetEvent);
            //else
            _api.DequeueAsync(request, ConnectTimeout, OnCompleted, dw);

            //_api.ReceiveAsync(
            //    OnFault,
            //    OnCompleted,
            //     DuplexTypes.WaitOne,
            //     resetEvent
            //    );

            //_api.SendDuplexAsync(message,
            //    (err) => OnErrorOcurred(new GenericEventArgs<string>(err)),
            //    (qitem) => OnMessageReceived(qitem));
        }
Beispiel #2
0
        //public TopicListener(string queueName, string serverName = ".")
        //    : base(queueName, serverName)
        //{

        //}

        #endregion

        #region override

        //protected override Listener CreateListener(AdapterProperties lp)
        //{
        //    return new ListenerQ(this, lp);
        //}

        //public override Listener Find(string hostName)
        //{
        //    if (hostName == null)
        //    {
        //        throw new ArgumentNullException("Find.hostName");
        //    }
        //    return Listeners.Where(q => q.Source.HostName == hostName).FirstOrDefault<Listener>();
        //}

        //public void Abort(Ptr ptr)
        //{
        //    var listener = EnsureListener(_adapter.Source);
        //    listener.Abort(ptr);
        //}

        //public void Commit(Ptr ptr)
        //{
        //    var listener = EnsureListener(_adapter.Source);
        //    listener.Commit(ptr);
        //}



        #endregion


        //protected override IQueueAck Send(QueueItem message)
        //{
        //    return _api.Enqueue(message);
        //}

        protected override void ReceiveAsync(IDynamicWait dw)
        {
            _api.Dequeue((IQueueItem item) => {
                if (dw != null)
                {
                    dw.DynamicWaitAck(item != null);
                }
                OnMessageReceived(item);
            });

            //_api.DequeueAsync(
            //    (err) => OnErrorOcurred(new GenericEventArgs<string>(err)),
            //    (qitem) => OnMessageReceived(qitem),
            //     DuplexTypes.WaitOne,
            //     resetEvent
            //    );
        }
Beispiel #3
0
        public void DequeueAsync(QueueRequest message, int connectTimeout, Action <IQueueItem> onCompleted, IDynamicWait aw)
        {
            message.QCommand = QueueCmd.Dequeue;
            //message.Host = this._QueueName;
            //message.MessageState = MessageState.Sending;

            ConsumItem(message, connectTimeout, onCompleted, aw);
        }
Beispiel #4
0
 protected abstract void ReceiveAsync(IDynamicWait aw);