/// <summary>
        /// 创建生产者
        /// </summary>
        /// <param name="messageQueueInfo">消息队列信息</param>
        /// <returns>生产者</returns>
        public IProducer CreateProducer(MessageQueueInfo messageQueueInfo)
        {
            ValidateUtil.ValidateNull(messageQueueInfo, "Rabbit消息队列信息");
            ValidateConnection();

            IProducer producer = new RabbitProducer(CreateChannel(), RabbitMessageQueueInfo.From(messageQueueInfo));

            AddClosedEventHandler(producer);

            return(producer);
        }
        /// <summary>
        /// 创建RPC服务端
        /// </summary>
        /// <param name="messageQueueInfo">消息队列信息</param>
        /// <returns>RPC服务端</returns>
        public IRpcServer CreateRpcServer(MessageQueueInfo messageQueueInfo)
        {
            ValidateUtil.ValidateNull(messageQueueInfo, "Rabbit消息队列信息");
            ValidateConnection();

            IRpcServer rpcServer = new RabbitRpcServer(CreateChannel(), RabbitMessageQueueInfo.From(messageQueueInfo));

            AddClosedEventHandler(rpcServer);

            return(rpcServer);
        }
Example #3
0
 /// <summary>
 /// 构造方法
 /// 初始化各个对象以便就绪
 /// </summary>
 /// <param name="channel">渠道</param>
 /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
 public RabbitCoreBase(IModel channel, IMessageQueueInfoFactory messageQueueInfoFactory)
     : this(channel, RabbitMessageQueueInfo.From(messageQueueInfoFactory.Create()))
 {
 }
Example #4
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))))
 {
 }