MsmqIntegrationMessageProperty.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //
  2. // MsmqIntegrationMessageProperty.cs
  3. //
  4. // Author: Atsushi Enomoto <[email protected]>
  5. //
  6. // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining
  9. // a copy of this software and associated documentation files (the
  10. // "Software"), to deal in the Software without restriction, including
  11. // without limitation the rights to use, copy, modify, merge, publish,
  12. // distribute, sublicense, and/or sell copies of the Software, and to
  13. // permit persons to whom the Software is furnished to do so, subject to
  14. // the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be
  17. // included in all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. //
  27. using System;
  28. using System.Messaging;
  29. using System.ServiceModel;
  30. using System.ServiceModel.Channels;
  31. using SMessage = System.ServiceModel.Channels.Message;
  32. using MQMessage = System.Messaging.Message;
  33. using MQMessageType = System.Messaging.MessageType;
  34. namespace System.ServiceModel.MsmqIntegration
  35. {
  36. public sealed class MsmqIntegrationMessageProperty
  37. {
  38. public const string Name = "MsmqIntegrationMessageProperty";
  39. public MsmqIntegrationMessageProperty ()
  40. {
  41. }
  42. [MonoTODO]
  43. public static MsmqIntegrationMessageProperty Get (SMessage message)
  44. {
  45. throw new NotImplementedException ();
  46. }
  47. // not verified / consider queue property filter
  48. internal static MsmqIntegrationMessageProperty Get (MQMessage message)
  49. {
  50. if (message == null)
  51. throw new ArgumentNullException ("message");
  52. var p = new MsmqIntegrationMessageProperty ();
  53. p.Id = message.Id;
  54. p.Label = message.Label;
  55. p.CorrelationId = message.CorrelationId;
  56. p.Body = message.Body;
  57. p.Extension = message.Extension;
  58. p.SenderId = message.SenderId;
  59. p.DestinationQueue = CreateUriFromQueue (message.DestinationQueue);
  60. if (message.AdministrationQueue != null)
  61. p.AdministrationQueue = CreateUriFromQueue (message.AdministrationQueue);
  62. if (message.ResponseQueue != null)
  63. p.ResponseQueue = CreateUriFromQueue (message.ResponseQueue);
  64. // FIXME: check property filter in the queue
  65. p.AppSpecific = message.AppSpecific;
  66. p.ArrivedTime = message.ArrivedTime;
  67. p.Authenticated = message.Authenticated;
  68. p.Priority = message.Priority;
  69. p.SentTime = message.SentTime;
  70. p.TimeToReachQueue = message.TimeToReachQueue;
  71. switch (message.MessageType) {
  72. case MQMessageType.Acknowledgment:
  73. p.AcknowledgeType = message.AcknowledgeType;
  74. p.Acknowledgment = message.Acknowledgment;
  75. break;
  76. case MQMessageType.Normal:
  77. case MQMessageType.Report:
  78. // anything to do?
  79. break;
  80. }
  81. return p;
  82. }
  83. static Uri CreateUriFromQueue (MessageQueue queue)
  84. {
  85. // FIXME: implement
  86. throw new NotImplementedException ();
  87. }
  88. public AcknowledgeTypes? AcknowledgeType { get; set; }
  89. public Acknowledgment? Acknowledgment { get; private set; }
  90. public Uri AdministrationQueue { get; set; }
  91. public int? AppSpecific { get; set; }
  92. public DateTime? ArrivedTime { get; private set; }
  93. public bool? Authenticated { get; private set; }
  94. public object Body { get; set; }
  95. public int? BodyType { get; set; }
  96. public string CorrelationId { get; set; }
  97. public Uri DestinationQueue { get; private set; }
  98. public byte [] Extension { get; set; }
  99. public string Id { get; private set; }
  100. public string Label { get; set; }
  101. public MessageType? MessageType { get; private set; }
  102. public MessagePriority? Priority { get; set; }
  103. public Uri ResponseQueue { get; set; }
  104. public byte [] SenderId { get; private set; }
  105. public DateTime? SentTime { get; private set; }
  106. public TimeSpan? TimeToReachQueue { get; set; }
  107. }
  108. }