Exemple #1
0
        public AsyncOperationSample(string accessKeyId, string secretAccessKey, string endpoint)
        {
            _accessKeyId     = accessKeyId;
            _secretAccessKey = secretAccessKey;
            _endpoint        = endpoint;

            _client = new MNSClient(_accessKeyId, _secretAccessKey, _endpoint);
        }
Exemple #2
0
        private IMNS getInstance()
        {
            if (client == null)
            {
                client = new MNSClient(_accessKeyId, _secretAccessKey, _endpoint);
            }

            return(client);
        }
Exemple #3
0
 public MnsFactory(string accessKeyId     = "LTAI4Fv8hnfMCJ1GzLJB61wn",
                   string secretAccessKey = "mhr2puLfvrWqU3aoMBM5XzlKiUlOLd",
                   string endpoint        = "http://1502656352964375.mns.cn-hangzhou.aliyuncs.com/")
 {
     this._accessKeyId     = accessKeyId;
     this._secretAccessKey = secretAccessKey;
     this._endpoint        = endpoint;
     client = getInstance();
 }
 public AliyunQueue(string queueName)
 {
     _client = new MNSClient(_accessKeyId, _secretAccessKey, _endpoint);
     this._queueName = queueName;
     try
     {
         _queue = _client.GetNativeQueue(_queueName);
     }
     catch (Exception ex)
     {
         _queue = _client.CreateQueue(queueName);
     }
 }
 public void SetUp()
 {
     client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint);
     client.CreateQueue("UTQueue");
     try
     {
         client.DeleteQueue("UTQueue2");
     }
     catch (Exception)
     {
         // do nothing
     }
 }
 public AliyunMNSPublisher(IRemoteEventBus eventBus)
 {
     _eventbus = (AliyunMNSEventBus)eventBus;
     try
     {
         _client = new MNSClient(_eventbus.AccessKeyId, _eventbus.AccessKeySecret, _eventbus.Endpoint);
     }
     catch (Exception ex)
     {
         XTrace.WriteLine($"创建阿里云消息发送器失败,请检查配置文件或阿里云配置是否正确。");
         XTrace.WriteException(ex);
         throw ex;
     }
 }
Exemple #7
0
        private void CreateClient()
        {
            if (null != client)
            {
                return;
            }

            try
            {
                client = new MNSClient(setting.AccessKey, setting.AccessSecret, setting.Endpoint);
                client.GetAccountAttributes();
            }
            catch
            {
                throw;
            }
        }
Exemple #8
0
        public void SetUp()
        {
            var config = Newtonsoft.Json.JsonConvert.DeserializeObject <ConfigModel>(File.ReadAllText(@"E:\MNS.json"));

            _accessKeyId     = config.AccessKeyId;
            _secretAccessKey = config.AccessKey;
            _endpoint        = config.EndPoint;
            client           = new MNSClient(_accessKeyId, _secretAccessKey, _endpoint);
            client.CreateTopic("UTTopic");
            try
            {
                client.DeleteTopic("UTTopic2");
            }
            catch (Exception)
            {
                // do nothing
            }
        }
 public AliyunMessageQueue()
 {
     _client = new MNSClient(_accessKeyId, _secretAccessKey, _endpoint);
 }
Exemple #10
0
 public MNSCore(string queueName, string accessKeyId, string secretAccessKey, string endpoint)
 {
     _client   = new MNSClient(accessKeyId, secretAccessKey, endpoint);
     QueueName = queueName;
 }
Exemple #11
0
 public TopicAgent(IMNS client, string topicName)
 {
     topic = client.GetNativeTopic(topicName);
 }