예제 #1
0
        /// <summary>
        /// 注册Topic模式的持久化Exchange和Queue
        /// </summary>
        /// <param name="exchangeName">Exchange</param>
        /// <param name="queueName">Queue</param>
        /// <param name="typeName">队列模式</param>
        /// <param name="routeKey">路由Key</param>
        /// <param name="exchangeDurable">Exchange持久化</param>
        /// <param name="exchangeAutoDelete">Exchange断线自动删除</param>
        /// <param name="queueDurable">Queue持久化</param>
        /// <param name="queueAutoDelete">Queue断线自动删除</param>
        /// <param name="queueExclusive">Queue排他性</param>
        /// <returns>消息发布者</returns>
        public static IQueuePublisher GerarateIQueuePublisher(string exchangeName, string typeName = "topic", string routeKey = "", bool exchangeDurable = true, bool exchangeAutoDelete = false)
        {
            IQueuePublisher client = new MessageQueueClient();

            client.Register_durable_Exchange_and_Queue(IP, Port, UserName, Password, exchangeName, typeName, routeKey, exchangeDurable, exchangeAutoDelete);
            return(client);
        }
예제 #2
0
        /// <summary>
        /// 注册Topic模式的持久化Exchange和Queue
        /// </summary>
        /// <param name="exchangeName">Exchange</param>
        /// <param name="queueName">Queue</param>
        /// <param name="typeName">队列模式</param>
        /// <param name="routeKey">路由Key</param>
        /// <param name="exchangeDurable">Exchange持久化</param>
        /// <param name="exchangeAutoDelete">Exchange断线自动删除</param>
        /// <param name="queueDurable">Queue持久化</param>
        /// <param name="queueAutoDelete">Queue断线自动删除</param>
        /// <param name="queueExclusive">Queue排他性,离线自动删除</param>
        /// <param name="prefetchCount">订阅者预取消息数量</param>
        /// <param name="noAck">无需Ack回复</param>
        /// <returns>消息订阅者</returns>
        public static IQueueSubscriber GerarateIQueueSubscriber(string exchangeName, string queueName, string typeName = "topic", string routeKey = "", bool exchangeDurable = true, bool exchangeAutoDelete = false, bool queueDurable = true, bool queueAutoDelete = false, bool queueExclusive = false, ushort prefetchCount = 0, bool noAck = false, int maxLength = -1, int maxBytes = -1, int messageTtl = -1)
        {
            IQueueSubscriber client = new MessageQueueClient();

            client.Register_durable_Exchange_and_Queue(IP, Port, UserName, Password, exchangeName, queueName, typeName, routeKey, exchangeDurable, exchangeAutoDelete, queueDurable, queueAutoDelete, queueExclusive, prefetchCount, noAck, maxLength, maxBytes, messageTtl);
            return(client);
        }