Apache.NMS.ActiveMQ.Util.SimplePriorityMessageDispatchChannel.Enqueue C# (CSharp) Method

Enqueue() public method

public Enqueue ( MessageDispatch dispatch ) : void
dispatch MessageDispatch
return void
        public void Enqueue(MessageDispatch dispatch)
        {
            lock(this.mutex)
            {
                GetList(dispatch).AddLast(dispatch);
                this.size++;
                Monitor.Pulse(this.mutex);
            }
        }

Usage Example

 public void TestEnqueue() 
 {
     SimplePriorityMessageDispatchChannel channel = new SimplePriorityMessageDispatchChannel();
     MessageDispatch dispatch1 = new MessageDispatch();
     MessageDispatch dispatch2 = new MessageDispatch();
 
     Assert.IsTrue( channel.Empty == true );
     Assert.IsTrue( channel.Count == 0 );
 
     channel.Enqueue( dispatch1 );
 
     Assert.IsTrue( channel.Empty == false );
     Assert.IsTrue( channel.Count == 1 );
 
     channel.Enqueue( dispatch2 );
 
     Assert.IsTrue( channel.Empty == false );
     Assert.IsTrue( channel.Count == 2 );
 }
All Usage Examples Of Apache.NMS.ActiveMQ.Util.SimplePriorityMessageDispatchChannel::Enqueue