Пример #1
0
        static void Main(string[] args)
        {
            ONSFactoryProperty factoryInfo = new ONSFactoryProperty();

            factoryInfo.setFactoryProperty(factoryInfo.getConsumerIdName(), "CID_5678");

            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();

            OrderConsumer pConsumer = onsfactory.getInstance().createOrderConsumer(factoryInfo);

            MessageOrderListener msgListener = new MyMsgListener();

            pConsumer.subscribe("Ram_Topic_2", "*", ref msgListener);

            pConsumer.start();

            Thread.Sleep(10000 * 100);

            pConsumer.shutdown();
        }
Пример #2
0
 public async Task <IConsumer> CreateConsumer(string consumerId)
 {
     _factoryProperty.setFactoryProperty(_factoryProperty.getConsumerIdName(), "CID_" + consumerId);
     return(await Task.Run(() => new AliyunConsumer(_factoryInstance.createPushConsumer(_factoryProperty))));
 }