/// <summary>
        /// 连接到消息代理
        /// </summary>
        /// <param name="brokerAddressForProducer"></param>
        /// <returns></returns>
        public static Producer Connect(MessageChannel brokerAddressForProducer)
        {
            Producer producer = new Producer(brokerAddressForProducer);

            producer.Connect();
            return(producer);
        }
        /// <summary>
        /// 连接到消息代理
        /// </summary>
        /// <param name="brokerAddressForConsumer"></param>
        /// <returns></returns>
        public static Consumer Connect(MessageChannel brokerAddressForConsumer)
        {
            Consumer consumer = new Consumer(brokerAddressForConsumer);

            consumer.Connect();
            return(consumer);
        }
Exemple #3
0
        /// <summary>
        /// 创建消息代理
        /// </summary>
        /// <returns></returns>
        public static Broker Start(MessageChannel producerPort, MessageChannel consumerPort)
        {
            Broker broker = new Broker(producerPort, consumerPort);

            broker.Start();
            return(broker);
        }
 /// <summary>
 /// 定义消息生产
 /// </summary>
 /// <param name="brokerAddressForProducer">需要接入的代理者地址</param>
 public Producer(MessageChannel brokerAddressForProducer)
 {
     this.brokerAddressForProducer = brokerAddressForProducer;
 }
 /// <summary>
 /// 定义消息消费
 /// </summary>
 /// <param name="brokerAddressForConsumer">需要接入的代理者地址</param>
 public Consumer(MessageChannel brokerAddressForConsumer)
 {
     this.brokerAddressWithConsumerPort = brokerAddressForConsumer;
 }
Exemple #6
0
 /// <summary>
 /// 定义消息代理
 /// </summary>
 /// <param name="producerPort">允许接入的生产者地址,允许所有ip地址填*</param>
 /// <param name="consumerPort">允许接入的消费者地址,允许所有ip地址填*</param>
 public Broker(MessageChannel producerPort, MessageChannel consumerPort)
 {
     this.producerPort = new MessageChannel[] { producerPort };
     this.consumerPort = new MessageChannel[] { consumerPort };
 }