예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Consumer"/> class.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <param name="formater">The formater.</param>
        /// <exception cref="Never.Exceptions.MessageException">配置MQ路由不能为空</exception>
        public Consumer(MessageConnection connection, IMessageFormatter formater)
        {
            this.connection = connection;
            if (connection == null || string.IsNullOrEmpty(connection.ConnetctionString))
            {
                throw new ArgumentNullException("配置MQ路由不能为空");
            }

            this.queue = new MessageQueue()
            {
                Formatter = formater ?? new BinaryMessageFormatter(),
                Path      = connection.ConnetctionString
            };
            this.queue.MessageReadPropertyFilter.Priority = true;
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Consumer"/> class.
 /// </summary>
 /// <param name="connection">The connection.</param>
 public Consumer(MessageConnection connection)
     : this(connection, new BinaryMessageFormatter())
 {
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Producer"/> class.
 /// </summary>
 /// <param name="connection">The connection.</param>
 public Producer(MessageConnection connection)
     : this(connection, new BinaryMessageFormatter())
 {
 }