/// <summary>
 /// 代理OrderProducer实例的start方法
 /// </summary>
 public void start()
 {
     if (_producer != null)
     {
         _producer.start();
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            ONSFactoryProperty factoryInfo = new ONSFactoryProperty();

            factoryInfo.setFactoryProperty(factoryInfo.getProducerIdName(), "PID_1234");
            Console.WriteLine("ProducerId:{0}, \nConsumerId:{1},\nPublishTopics:{2},\nMsgContent:{3},\nAccessKey::{4},\nSecretKey::{5} ",
                              factoryInfo.getProducerId(), factoryInfo.getConsumerId(), factoryInfo.getPublishTopics(),
                              factoryInfo.getMessageContent(), factoryInfo.getAccessKey(), factoryInfo.getSecretKey());

            ONSFactory onsfactory = new ONSFactory();

            OrderProducer pProducer = onsfactory.getInstance().createOrderProducer(factoryInfo);

            pProducer.start();

            string key = "abc";

            for (int i = 0; i < 20; ++i)
            {
                Message msg = new Message("Ram_Topic_2", "TagA", "msg from for loop => " + i);
                try
                {
                    SendResultONS sendResult = pProducer.send(msg, key);
                    Console.WriteLine("=> send success : {0} ", sendResult.getMessageId());
                }
                catch (ONSClientException e)
                {
                    Console.WriteLine("\nexception of sendmsg:{0}", e.what());
                }
            }

            Thread.Sleep(1000 * 100);
            pProducer.shutdown();
        }
Example #3
0
 /// <summary>
 ///     开启生产消息
 /// </summary>
 public void Start()
 {
     if (_producer == null)
     {
         // 获取实产者实例
         _producer = ONSFactory.getInstance().createOrderProducer(_factoryInfo);
         _producer.start();
     }
 }
Example #4
0
 public static void StartOrderProducer()
 {
     _orderproducer.start();
 }
Example #5
0
 public void InitializeOrderProducer()
 {
     orderProducer = ONSFactory.getInstance().createOrderProducer(factoryInfo);
     orderProducer.start();
 }
Example #6
0
 public override void Start()
 {
     producer = ONSFactory.getInstance().createOrderProducer(this.FactoryProperty);
     producer.start();
 }