/// <summary>
        /// 创建RPC服务端
        /// </summary>
        /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
        /// <returns>RPC服务端</returns>
        public IRpcServer CreateRpcServer(IMessageQueueInfoFactory messageQueueInfoFactory)
        {
            ValidateUtil.ValidateNull(messageQueueInfoFactory, "消息队列信息工厂");
            ValidateConnection();

            IRpcServer rpcServer = new RabbitRpcServer(CreateChannel(), messageQueueInfoFactory);

            AddClosedEventHandler(rpcServer);

            return(rpcServer);
        }
        /// <summary>
        /// 创建生产者
        /// </summary>
        /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
        /// <returns>生产者</returns>
        public IProducer CreateProducer(IMessageQueueInfoFactory messageQueueInfoFactory)
        {
            ValidateUtil.ValidateNull(messageQueueInfoFactory, "消息队列信息工厂");
            ValidateConnection();

            IProducer producer = new RabbitProducer(CreateChannel(), messageQueueInfoFactory);

            AddClosedEventHandler(producer);

            return(producer);
        }
        /// <summary>
        /// 创建RPC服务端
        /// </summary>
        /// <param name="queueOrOtherIdentify">队列或其他标识</param>
        /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
        /// <returns>RPC服务端</returns>
        public IRpcServer CreateRpcServer(string queueOrOtherIdentify, IMessageQueueInfoFactory messageQueueInfoFactory)
        {
            ValidateUtil.ValidateNull(messageQueueInfoFactory, "消息队列信息工厂");
            ValidateConnection();

            IRpcServer rpcServer = new RabbitRpcServer(CreateChannel(), queueOrOtherIdentify, messageQueueInfoFactory, virtualPath: virtualPath);

            AddClosedEventHandler(rpcServer);

            return(rpcServer);
        }
        /// <summary>
        /// 从配置里验证消息队列信息
        /// </summary>
        /// <param name="queueOrOtherIdentify">队列或其他标识</param>
        /// <returns>Rabbit消息队列信息</returns>
        private RabbitMessageQueueInfo ValidateMessageQueueInfoFromConfig(string queueOrOtherIdentify)
        {
            if (MessageQueueInfoFactory == null)
            {
                MessageQueueInfoFactory = new RabbitMessageQueueInfoConfigFactory();
            }

            RabbitMessageQueueInfo rabbitMessageQueueInfo = MessageQueueInfoFactory.Create(queueOrOtherIdentify) as RabbitMessageQueueInfo;

            ValidateUtil.ValidateNull2(rabbitMessageQueueInfo, string.Format("队列或其他标识[{0}]在配置里不存在", queueOrOtherIdentify));

            return(rabbitMessageQueueInfo);
        }
Exemple #5
0
 /// <summary>
 /// 构造方法
 /// 初始化各个对象以便就绪
 /// </summary>
 /// <param name="channel">渠道</param>
 /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
 public RabbitCoreBase(IModel channel, IMessageQueueInfoFactory messageQueueInfoFactory)
     : this(channel, RabbitMessageQueueInfo.From(messageQueueInfoFactory.Create()))
 {
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="channel">渠道</param>
 /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
 public RabbitRpcServer(IModel channel, IMessageQueueInfoFactory messageQueueInfoFactory)
     : base(channel, messageQueueInfoFactory)
 {
 }
Exemple #7
0
 /// <summary>
 /// 构造方法
 /// 初始化各个对象以便就绪
 /// </summary>
 /// <param name="channel">渠道</param>
 /// <param name="queueOrOtherIdentify">队列或其他标识</param>
 /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
 /// <param name="virtualPath">虚拟路径</param>
 public RabbitRpcServer(IModel channel, string queueOrOtherIdentify, IMessageQueueInfoFactory messageQueueInfoFactory, string virtualPath = RabbitConnectionInfo.DEFAULT_VIRTUAL_PATH)
     : this(channel, RabbitMessageQueueInfo.From(messageQueueInfoFactory.Create(queueOrOtherIdentify, ConfigUtil.CreateContainerVirtualPathDic(virtualPath))))
 {
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="channel">渠道</param>
 /// <param name="queueOrOtherIdentify">队列或其他标识</param>
 /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
 /// <param name="virtualPath">虚拟路径</param>
 public RabbitProducer(IModel channel, string queueOrOtherIdentify, IMessageQueueInfoFactory messageQueueInfoFactory, string virtualPath = RabbitConnectionInfo.DEFAULT_VIRTUAL_PATH)
     : base(channel, queueOrOtherIdentify, messageQueueInfoFactory, virtualPath)
 {
 }
Exemple #9
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="channel">渠道</param>
 /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
 public RabbitProducer(IModel channel, IMessageQueueInfoFactory messageQueueInfoFactory)
     : base(channel, messageQueueInfoFactory)
 {
 }