1. public class MessageQueue
  2. {
  3. #region Private Properties
  4. private const string _accessKeyId = "";
  5. private const string _secretAccessKey = "";
  6. private const string _endpoint = "";
  7.  
  8. private static string _queueName;
  9. private const int _receiveTimes = 1;
  10. private const int _receiveInterval = 2;
  11. private const int batchSize = 6;
  12.  
  13. #endregion
  14.  
  15. #region 设置队列名称
  16. public string queueName
  17. {
  18. set
  19. {
  20. _queueName = value;
  21.  
  22. }
  23. get
  24. {
  25. return _queueName;
  26. }
  27. }
  28. #endregion
  29.  
  30. #region 判断消息队列是否存在
  31. /// <summary>
  32. /// 判断消息队列是否存在
  33. /// </summary>
  34. /// <returns></returns>
  35. public static bool QueueIsExist()
  36. {
  37. bool flag = false;
  38. try
  39. {
  40. using (IMNS client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint))
  41. {
  42. var nativeQueue = client.GetNativeQueue(_queueName);
  43. var getQueueAttributesResponse = nativeQueue.GetAttributes();
  44. flag = true;
  45. }
  46. }
  47. catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  48. return flag;
  49. }
  50. #endregion
  51.  
  52. #region 创建消息队列
  53. /// <summary>
  54. /// 创建消息队列
  55. /// </summary>
  56. /// <returns></returns>
  57. public static string CreateQueue()
  58. {
  59. /*
  60. DelaySeconds 发送到该 Queue 的所有消息默认将以DelaySeconds参数指定的秒数延后可被消费,单位为秒。 0-604800秒(7天)范围内某个整数值,默认值为0
  61. MaximumMessageSize 发送到该Queue的消息体的最大长度,单位为byte。 1024(1KB)-65536(64KB)范围内的某个整数值,默认值为65536(64KB)。
  62. MessageRetentionPeriod 消息在该 Queue 中最长的存活时间,从发送到该队列开始经过此参数指定的时间后,不论消息是否被取出过都将被删除,单位为秒。 60 (1分钟)-1296000 (15 天)范围内某个整数值,默认值345600 (4 天)
  63. VisibilityTimeout 消息从该 Queue 中取出后从Active状态变成Inactive状态后的持续时间,单位为秒。 1-43200(12小时)范围内的某个值整数值,默认为30(秒)
  64. PollingWaitSeconds 当 Queue 中没有消息时,针对该 Queue 的 ReceiveMessage 请求最长的等待时间,单位为秒。 0-30秒范围内的某个整数值,默认为0(秒)
  65. LoggingEnabled 是否开启日志管理功能,True表示启用,False表示停用 True/False,默认为False
  66. */
  67. string queueName = string.Empty;
  68. var createQueueRequest = new CreateQueueRequest
  69. {
  70. QueueName = _queueName,
  71. Attributes =
  72. {
  73. DelaySeconds = 0,
  74. MaximumMessageSize = 65536,
  75. MessageRetentionPeriod = 345600,
  76. VisibilityTimeout = 3600,
  77. PollingWaitSeconds = 3
  78. }
  79. };
  80. try
  81. {
  82. using (IMNS client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint))
  83. {
  84. var queue = client.CreateQueue(createQueueRequest);
  85. queueName = queue.QueueName;
  86. }
  87. }
  88. catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  89. Thread.Sleep(2000);
  90. return queueName;
  91. }
  92. #endregion
  93.  
  94. #region 删除消息队列
  95. /// <summary>
  96. /// 删除消息队列
  97. /// </summary>
  98. /// <returns></returns>
  99. public static bool DeleteQueue()
  100. {
  101. bool flag = false;
  102. var deleteQueueRequest = new DeleteQueueRequest(_queueName);
  103. deleteQueueRequest.AddHeader("Accept", "IE6"); //Add extra request headers
  104. //deleteQueueRequest.AddParameter("param1", "value1"); //InvalidQueryString
  105. try
  106. {
  107. using (IMNS client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint))
  108. {
  109. var deleteQueueResponse = client.DeleteQueue(deleteQueueRequest);
  110. flag = true;
  111. }
  112. }
  113. catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  114. return flag;
  115. }
  116. #endregion
  117.  
  118. #region 发送消息(单条或多条)
  119. /// <summary>
  120. /// 发送消息(单条或多条)
  121. /// </summary>
  122. /// <param name="models">SendMessageRequest集合</param>
  123. /// <returns></returns>
  124. public static bool BathSendMessage(List<SendMessageRequest> models)
  125. {
  126. bool flag = false;
  127. try
  128. {
  129. using (IMNS client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint))
  130. {
  131. var nativeQueue = client.GetNativeQueue(_queueName);
  132. List<SendMessageRequest> requests = new List<SendMessageRequest>();
  133. for (int i = 0; i < models.Count; i++)
  134. {
  135. requests.Add(models[i]);
  136. }
  137. BatchSendMessageRequest batchSendRequest = new BatchSendMessageRequest()
  138. {
  139. Requests = requests
  140. };
  141. var sendMessageResponse = nativeQueue.BatchSendMessage(batchSendRequest);
  142. flag = true;
  143. }
  144. }
  145. catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  146. return flag;
  147. }
  148. #endregion
  149.  
  150. #region 消费消息(单条或多条)
  151. /// <summary>
  152. /// 消费消息(单条或多条)
  153. /// </summary>
  154. /// <param name="itemNum">数目</param>
  155. /// <returns></returns>
  156. public static List<Message> ReceiveMessage(int itemNum)
  157. {
  158. List<Message> lists = new List<Message>();
  159. try
  160. {
  161. using (IMNS client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint))
  162. {
  163. var nativeQueue = client.GetNativeQueue(_queueName);
  164. for (int i = 0; i < itemNum; i++)
  165. {
  166. var receiveMessageResponse = nativeQueue.ReceiveMessage();
  167. Message message = receiveMessageResponse.Message;
  168. lists.Add(message);
  169. }
  170. }
  171. }
  172. catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  173. return lists;
  174. }
  175. #endregion
  176.  
  177. #region 删除消息
  178. /// <summary>
  179. /// 删除消息
  180. /// </summary>
  181. /// <param name="receiptHandle">receiptHandle</param>
  182. /// <returns></returns>
  183. public static bool DeleteMessage(string receiptHandle)
  184. {
  185. bool flag = false;
  186. var deletedReceiptHandle = receiptHandle;
  187. try
  188. {
  189. using (IMNS client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint))
  190. {
  191. var nativeQueue = client.GetNativeQueue(_queueName);
  192. var deleteMessageResponse = nativeQueue.DeleteMessage(receiptHandle);
  193. flag = true;
  194. }
  195. }
  196. catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  197. return flag;
  198. }
  199. #endregion
  200.  
  201. #region 修改消息可见时间
  202. /// <summary>
  203. /// 修改消息可见时间
  204. /// </summary>
  205. /// <param name="receiptHandle">receiptHandle</param>
  206. /// <param name="visibilityTimeout">从现在到下次可被用来消费的时间间隔</param>
  207. /// <returns></returns>
  208. public static bool ChangeMessageVisibility(string receiptHandle, int visibilityTimeout)
  209. {
  210. bool flag = false;
  211. var deletedReceiptHandle = receiptHandle;
  212. try
  213. {
  214. using (IMNS client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint))
  215. {
  216. var nativeQueue = client.GetNativeQueue(_queueName);
  217. var changeMessageVisibilityRequest = new ChangeMessageVisibilityRequest
  218. {
  219. ReceiptHandle = receiptHandle,
  220. VisibilityTimeout = visibilityTimeout
  221. };
  222. var changeMessageVisibilityResponse = nativeQueue.ChangeMessageVisibility(changeMessageVisibilityRequest);
  223. flag = true;
  224. }
  225. }
  226. catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  227. return flag;
  228. }
  229. #endregion
  230. }
  1. using System;
  2. using System.IO;
  3. using System.Text;
  4. using System.Threading;
  5. using System.Security.Cryptography;
  6. using Aliyun.OSS.Common;
  7.  
  8. namespace Aliyun.OSS.Samples
  9. {
  10. /// <summary>
  11. /// 获取OSS对象
  12. /// </summary>
  13. public static class GetObjectSample
  14. {
  15. static string accessKeyId = Config.AccessKeyId;
  16. static string accessKeySecret = Config.AccessKeySecret;
  17. static string endpoint = Config.Endpoint;
  18. static OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
  19.  
  20. static string key = "123456.jpg";
  21. static string fileToUpload = Config.FileToUpload;
  22. static string dirToDownload = Config.DirToDownload;
  23.  
  24. static AutoResetEvent _event = new AutoResetEvent(false);
  25.  
  26. public static void GetObjects(string bucketName)
  27. {
  28. GetObject(bucketName); //获取文件
  29.  
  30. GetObjectByRequest(bucketName);
  31.  
  32. AsyncGetObject(bucketName); //异步方式获取文件
  33. }
  34.  
  35. public static void GetObject(string bucketName)
  36. {
  37. try
  38. {
  39. client.PutObject(bucketName, key, fileToUpload);
  40.  
  41. var result = client.GetObject(bucketName, key);
  42.  
  43. using (var requestStream = result.Content)
  44. {
  45. using (var fs = File.Open(Path.Combine(dirToDownload, key), FileMode.OpenOrCreate))
  46. {
  47. int length = 4 * 1024;
  48. var buf = new byte[length];
  49. do
  50. {
  51. length = requestStream.Read(buf, 0, length);
  52. fs.Write(buf, 0, length);
  53. } while (length != 0);
  54. }
  55. }
  56.  
  57. Console.WriteLine("Get object succeeded");
  58. }
  59. catch (OssException ex)
  60. {
  61. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  62. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  63. }
  64. catch (Exception ex)
  65. {
  66. Console.WriteLine("Failed with error info: {0}", ex.Message);
  67. }
  68. }
  69.  
  70. public static void GetObjectByRequest(string bucketName)
  71. {
  72. try
  73. {
  74. client.PutObject(bucketName, key, fileToUpload);
  75.  
  76. var request = new GetObjectRequest(bucketName, key);
  77. request.SetRange(0, 100);
  78.  
  79. var result = client.GetObject(request);
  80.  
  81. Console.WriteLine("Get object succeeded, length:{0}", result.Metadata.ContentLength);
  82. }
  83. catch (OssException ex)
  84. {
  85. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  86. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  87. }
  88. catch (Exception ex)
  89. {
  90. Console.WriteLine("Failed with error info: {0}", ex.Message);
  91. }
  92. }
  93.  
  94. public static void AsyncGetObject(string bucketName)
  95. {
  96. const string key = "AsyncGetObject";
  97. try
  98. {
  99. client.PutObject(bucketName, key, fileToUpload);
  100.  
  101. string result = "Notice user: put object finish";
  102. client.BeginGetObject(bucketName, key, GetObjectCallback, result.Clone());
  103.  
  104. _event.WaitOne();
  105. }
  106. catch (OssException ex)
  107. {
  108. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  109. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  110. }
  111. catch (Exception ex)
  112. {
  113. Console.WriteLine("Failed with error info: {0}", ex.Message);
  114. }
  115. }
  116.  
  117. private static void GetObjectCallback(IAsyncResult ar)
  118. {
  119. try
  120. {
  121. var result = client.EndGetObject(ar);
  122.  
  123. using (var requestStream = result.Content)
  124. {
  125. using (var fs = File.Open(dirToDownload + "/sample2.data", FileMode.OpenOrCreate))
  126. {
  127. int length = 4 * 1024;
  128. var buf = new byte[length];
  129. do
  130. {
  131. length = requestStream.Read(buf, 0, length);
  132. fs.Write(buf, 0, length);
  133. } while (length != 0);
  134. }
  135. }
  136.  
  137. Console.WriteLine(ar.AsyncState as string);
  138. }
  139. catch (Exception ex)
  140. {
  141. Console.WriteLine(ex.Message);
  142. }
  143. finally
  144. {
  145. _event.Set();
  146. }
  147. }
  148. }
  149. }
  1. using System;
  2. using System.Collections.Generic;
  3. using Aliyun.OSS.Common;
  4.  
  5. namespace Aliyun.OSS.Samples
  6. {
  7. /// <summary>
  8. /// 删除OSS对象
  9. /// </summary>
  10. public static class DeleteObjectsSample
  11. {
  12. static string accessKeyId = Config.AccessKeyId;
  13. static string accessKeySecret = Config.AccessKeySecret;
  14. static string endpoint = Config.Endpoint;
  15. static OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
  16.  
  17. public static void DeleteObject(string bucketName)
  18. {
  19. try
  20. {
  21. string key = null;
  22. var listResult = client.ListObjects(bucketName);
  23. foreach (var summary in listResult.ObjectSummaries)
  24. {
  25. key = summary.Key;
  26. break;
  27. }
  28.  
  29. client.DeleteObject(bucketName, key);
  30.  
  31. Console.WriteLine("Delete object succeeded");
  32. }
  33. catch (OssException ex)
  34. {
  35. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  36. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  37. }
  38. catch (Exception ex)
  39. {
  40. Console.WriteLine("Failed with error info: {0}", ex.Message);
  41. }
  42. }
  43.  
  44. public static void DeleteObjects(string bucketName)
  45. {
  46. try
  47. {
  48. var keys = new List<string>();
  49. var listResult = client.ListObjects(bucketName);
  50. foreach (var summary in listResult.ObjectSummaries)
  51. {
  52. keys.Add(summary.Key);
  53. break; //不跳出删除全部
  54. }
  55. var request = new DeleteObjectsRequest(bucketName, keys, false);
  56. client.DeleteObjects(request);
  57.  
  58. Console.WriteLine("Delete objects succeeded");
  59. }
  60. catch (OssException ex)
  61. {
  62. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  63. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  64. }
  65. catch (Exception ex)
  66. {
  67. Console.WriteLine("Failed with error info: {0}", ex.Message);
  68. }
  69. }
  70. }
  71. }
  1. using System;
  2. using System.IO;
  3. using System.Threading;
  4. using Aliyun.OSS.Common;
  5. using System.Text;
  6. using Aliyun.OSS.Util;
  7.  
  8. namespace Aliyun.OSS.Samples
  9. {
  10. /// <summary>
  11. /// 上传文件或对象到OSS
  12. /// </summary>
  13. public static class PutObjectSample
  14. {
  15. static string accessKeyId = Config.AccessKeyId;
  16. static string accessKeySecret = Config.AccessKeySecret;
  17. static string endpoint = Config.Endpoint;
  18. static OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
  19.  
  20. static string fileToUpload = Config.FileToUpload;
  21.  
  22. static AutoResetEvent _event = new AutoResetEvent(false);
  23.  
  24. /// <summary>
  25. /// sample for put object to oss
  26. /// </summary>
  27. public static void PutObject(string bucketName)
  28. {
  29. PutObjectFromFile(bucketName); //上传文件
  30.  
  31. PutObjectFromString(bucketName); //上传String
  32.  
  33. PutObjectWithDir(bucketName); //创建目录上传
  34.  
  35. PutObjectWithMd5(bucketName); //MD5验证上传
  36.  
  37. PutObjectWithHeader(bucketName); //设置Header上传
  38.  
  39. AsyncPutObject(bucketName); //异步上传
  40. }
  41.  
  42. public static void PutObjectFromFile(string bucketName)
  43. {
  44. const string key = "PutObjectFromFile";
  45. try
  46. {
  47. client.PutObject(bucketName, key, fileToUpload);
  48. Console.WriteLine("Put object:{0} succeeded", key);
  49. }
  50. catch (OssException ex)
  51. {
  52. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  53. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  54. }
  55. catch (Exception ex)
  56. {
  57. Console.WriteLine("Failed with error info: {0}", ex.Message);
  58. }
  59. }
  60.  
  61. public static void PutObjectFromString(string bucketName)
  62. {
  63. const string key = "PutObjectFromString";
  64. const string str = "Aliyun OSS SDK for C#";
  65.  
  66. try
  67. {
  68. byte[] binaryData = Encoding.ASCII.GetBytes(str);
  69. var stream = new MemoryStream(binaryData);
  70.  
  71. client.PutObject(bucketName, key, stream);
  72. Console.WriteLine("Put object:{0} succeeded", key);
  73. }
  74. catch (OssException ex)
  75. {
  76. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  77. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  78. }
  79. catch (Exception ex)
  80. {
  81. Console.WriteLine("Failed with error info: {0}", ex.Message);
  82. }
  83. }
  84.  
  85. public static void PutObjectWithDir(string bucketName)
  86. {
  87. const string key = "folder/sub_folder/PutObjectFromFile";
  88.  
  89. try
  90. {
  91. client.PutObject(bucketName, key, fileToUpload);
  92. Console.WriteLine("Put object:{0} succeeded", key);
  93. }
  94. catch (OssException ex)
  95. {
  96. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  97. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  98. }
  99. catch (Exception ex)
  100. {
  101. Console.WriteLine("Failed with error info: {0}", ex.Message);
  102. }
  103. }
  104.  
  105. public static void PutObjectWithMd5(string bucketName)
  106. {
  107. const string key = "PutObjectWithMd5";
  108.  
  109. string md5;
  110. using (var fs = File.Open(fileToUpload, FileMode.Open))
  111. {
  112. md5 = OssUtils.ComputeContentMd5(fs, fs.Length);
  113. }
  114.  
  115. var meta = new ObjectMetadata() { ContentMd5 = md5 };
  116. try
  117. {
  118. client.PutObject(bucketName, key, fileToUpload, meta);
  119.  
  120. Console.WriteLine("Put object:{0} succeeded", key);
  121. }
  122. catch (OssException ex)
  123. {
  124. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  125. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  126. }
  127. catch (Exception ex)
  128. {
  129. Console.WriteLine("Failed with error info: {0}", ex.Message);
  130. }
  131. }
  132.  
  133. public static void PutObjectWithHeader(string bucketName)
  134. {
  135. const string key = "PutObjectWithHeader";
  136. try
  137. {
  138. using (var content = File.Open(fileToUpload, FileMode.Open))
  139. {
  140. var metadata = new ObjectMetadata();
  141. metadata.ContentLength = content.Length;
  142.  
  143. metadata.UserMetadata.Add("github-account", "qiyuewuyi");
  144.  
  145. client.PutObject(bucketName, key, content, metadata);
  146.  
  147. Console.WriteLine("Put object:{0} succeeded", key);
  148. }
  149. }
  150. catch (OssException ex)
  151. {
  152. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  153. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  154. }
  155. catch (Exception ex)
  156. {
  157. Console.WriteLine("Failed with error info: {0}", ex.Message);
  158. }
  159. }
  160.  
  161. public static void AsyncPutObject(string bucketName)
  162. {
  163. const string key = "AsyncPutObject";
  164. try
  165. {
  166. // 1. put object to specified output stream
  167. using (var fs = File.Open(fileToUpload, FileMode.Open))
  168. {
  169. var metadata = new ObjectMetadata();
  170. metadata.UserMetadata.Add("mykey1", "myval1");
  171. metadata.UserMetadata.Add("mykey2", "myval2");
  172. metadata.CacheControl = "No-Cache";
  173. metadata.ContentType = "text/html";
  174.  
  175. string result = "Notice user: put object finish";
  176. client.BeginPutObject(bucketName, key, fs, metadata, PutObjectCallback, result.ToCharArray());
  177.  
  178. _event.WaitOne();
  179. }
  180. }
  181. catch (OssException ex)
  182. {
  183. Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
  184. ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
  185. }
  186. catch (Exception ex)
  187. {
  188. Console.WriteLine("Failed with error info: {0}", ex.Message);
  189. }
  190. }
  191.  
  192. private static void PutObjectCallback(IAsyncResult ar)
  193. {
  194. try
  195. {
  196. client.EndPutObject(ar);
  197.  
  198. Console.WriteLine(ar.AsyncState as string);
  199. }
  200. catch (Exception ex)
  201. {
  202. Console.WriteLine(ex.Message);
  203. }
  204. finally
  205. {
  206. _event.Set();
  207. }
  208. }
  209. }
  210. }

消息队列、OSS常用操作封装的更多相关文章

  1. .Net Excel操作之NPOI(二)常用操作封装

    一.Excel数据导出常用操作 1.指定表头和描述 2.指定数据库中读出的数据集合 二.ExcelExport封装 /// <summary> /// Excel常用的表格导出逻辑封装 / ...

  2. python openpyxl 2.5.4 版本 excel常用操作封装

    最近搭框架用的openpyxl 2.5.4版本,之前封装的函数有些提示不推荐使用了,我做了一些更新: 代码: # encoding=utf-8 from openpyxl import load_wo ...

  3. linux消息队列操作

    对消息队列的操作无非有以下三种类型: 1. 打开或创建消息队列消息队列的内核持续性要求每一个消息队列都在系统范围内相应唯一的键值,所以,要获得一个消息队列的描写叙述字,仅仅需提供该消息队列的键值就可以 ...

  4. Python操作rabbitmq消息队列持久化

    消息队列持久化 Python操作rabbit消息队列的持久化,如下: # 创建一个名为balance的队列,对queue进行durable持久化设为True(持久化第一步)channel.queue_ ...

  5. MSMQ消息队列 用法

    引言 接下来的三篇文章是讨论有关企业分布式开发的文章,这三篇文章筹划了很长时间,文章的技术并不算新,但是文章中使用到的技术都是经过笔者研究实践后总结的,正所谓站在巨人的肩膀上,笔者并不是巨人,但也希望 ...

  6. 跟我一起学WCF(1)——MSMQ消息队列

    一.引言 Windows Communication Foundation(WCF)是Microsoft为构建面向服务的应用程序而提供的统一编程模型,该服务模型提供了支持松散耦合和版本管理的序列化功能 ...

  7. Linux环境进程间通信(三):消息队列

    linux下进程间通信的几种主要手段: 管道(Pipe)及有名管道(named pipe):管道可用于具有亲缘关系进程间的通信,有名管道克服了管道没有名字的限制,因此,除具有管道所具有的功能外,它还允 ...

  8. 消息队列 概念 配合SpringBoot使用Demo

    转http://www.jianshu.com/p/048e954dab40 概念: 分布式消息队列 ‘分布式消息队列’包含两个概念 一是‘消息队列’,二是‘分布式’ 那么就先看下消息队列的概念,和为 ...

  9. WCF之MSMQ消息队列

    一.MSMQ简介 MSMQ(微软消息队列)是Windows操作系统中消息应用程序的基础,是用于创建分布式.松散连接的消息通讯应用程序的开发工具. MSMQ与XML Web Services和.Net ...

随机推荐

  1. centos 7 && dotnet core 2.0 && nginx && supervisor

    前提 系统:centos 7 目录:/home/wwwroot/www.wuball.com dotnet core 2.0 官方指引 sudo rpm --import https://packag ...

  2. 201521123073 《Java程序设计》第1周学习总结

    1.本章学习总结 你对于本章知识的学习总结 1.Java中使用Scanner处理输入,需要注意如下几个地方 程序开头必须import java.util.Scanner导入Scanner类. 使用Sc ...

  3. Android事件机制

    一句话描述: 用户和程序之间的互动机制 什么是事件? 用户和程序交互时触发的程序操作. 只要是事件,必须具备三方面: 1 事件的发生者 2 事件接受者 3 事件触发和传递 事件处理的方法 观察者模式: ...

  4. 201521123009 《Java程序设计》第10周学习总结

    1. 本周学习总结 2. 书面作业 本次PTA作业题集异常.多线程 Q1:finally 题目4-2 1.1 截图你的提交结果(出现学号) 1.2 4-2中finally中捕获异常需要注意什么? tr ...

  5. Java课程设计-计算器

    1.团队课程设计博客链接 http://www.cnblogs.com/yuanj/p/7072137.html 2.个人负责模块或任务说明 监听器的设置 3.自己的代码提交记录截图 //注册各个组件 ...

  6. 201521123012 《Java程序设计》第十三周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图.OneNote或其他)归纳总结多网络相关内容. 2. 书面作业 1. 网络基础 1.1 比较ping www.baidu.com与ping cec ...

  7. 201521123089 《Java程序设计》第12周学习总结

    1. 本周学习总结 1. Input Stream -- 数据提供者可从其中读数据输出流:Output Stream -- 数据接收者可往其中写数据: 2. 字符流底层具体读写操作还是使用字节流: 3 ...

  8. AIX盘rw_timeout值过小导致IO ERROR

    刚下班没多久,接收到告警提示数据库的数据文件异常,且同时收到主机硬盘的IO ERROR告警 该数据库服务器为AIX+oracle 9i环境,登录主机验证关键日志告警 发现确实在18点48分有磁盘IO的 ...

  9. AJAX多级下拉联动【JSON】

    前言 前面我们已经使用过了XML作为数据载体在AJAX中与服务器进行交互.当时候我们的案例是二级联动,使用Servlet进行控制 这次我们使用JSON作为数据载体在AJAX与服务器交互,使用三级联动, ...

  10. Spring - lookup-method方式实现依赖注入

    引言 假设一个单例模式的bean A需要引用另外一个非单例模式的bean B,为了在我们每次引用的时候都能拿到最新的bean B,我们可以让bean A通过实现ApplicationContextWa ...