示例#1
0
        /// <summary>
        /// Mock callback for <see cref="IModel.BasicConsume(string,bool,IBasicConsumer)"/> that throws a <see cref="Consume"/>
        /// event as a means for this object to simulate receiving a message.
        /// </summary>
        /// <param name="q">The queue name.</param>
        /// <param name="noAck">True if no acknowledgement of receipt is expected.</param>
        /// <param name="consumer">The consumer that would normally retrieve the message.</param>
        private void BasicConsume(string q, bool noAck, IBasicConsumer consumer)
        {
            var result = _bindings.ContainsKey(q) ? Subscribe(_bindings[q]) : Receive(q);

            if (Consume != null)
            {
                Consume.Invoke(this, new MessageQueueMockConsumeEventArgs(result));
            }
        }
示例#2
0
 public void Received(IActorRef consumer, IMessage <T> msg)
 {
     Consume?.Invoke(consumer, msg);
 }