Skip to content

Commit fd20ad8

Browse files
author
Nam Jeong Hyun
committed
First time commit
1 parent a5bfb3a commit fd20ad8

106 files changed

Lines changed: 15502 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
12+
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\Experimental.System.Messaging\Experimental.System.Messaging.csproj" />
17+
</ItemGroup>
18+
19+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
3+
namespace Experimental.System.Messaging.Test
4+
{
5+
public sealed class Order
6+
{
7+
public int OrderId {
8+
get;
9+
set;
10+
}
11+
12+
public DateTime OrderTime {
13+
get;
14+
set;
15+
}
16+
}
17+
18+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using System;
3+
4+
namespace Experimental.System.Messaging.Test
5+
{
6+
[TestClass]
7+
public class QueueClientTest
8+
{
9+
[TestMethod]
10+
public void SendMessage()
11+
{
12+
Order sentOrder = new Order
13+
{
14+
OrderId = 3,
15+
OrderTime = DateTime.Now
16+
};
17+
18+
MessageQueue myQueue = new MessageQueue(".\\Private$\\myQueue");
19+
myQueue.Send(sentOrder);
20+
}
21+
22+
[TestMethod]
23+
public void ReceiveMessage()
24+
{
25+
MessageQueue messageQueue = new MessageQueue(".\\Private$\\myQueue");
26+
messageQueue.Formatter = new XmlMessageFormatter(new Type[1]
27+
{
28+
typeof(Order)
29+
});
30+
31+
MessageQueue myQueue = messageQueue;
32+
Message myMessage = myQueue.Receive();
33+
Order myOrder = (Order)myMessage.Body;
34+
Console.WriteLine("Order ID: " + myOrder.OrderId.ToString());
35+
Console.WriteLine("Sent: " + myOrder.OrderTime.ToString());
36+
}
37+
}
38+
}

Experimental.System.Messaging.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27130.2010
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Experimental.System.Messaging", "Experimental.System.Messaging\Experimental.System.Messaging.csproj", "{4E15CB46-6B0A-4571-8B4A-DA0BB24F381F}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Experimental.System.Messaging.Test", "Experimental.System.Messaging.Test\Experimental.System.Messaging.Test.csproj", "{8B86BFC7-FAF7-40C0-9BAD-BEED6424F003}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{4E15CB46-6B0A-4571-8B4A-DA0BB24F381F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{4E15CB46-6B0A-4571-8B4A-DA0BB24F381F}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{4E15CB46-6B0A-4571-8B4A-DA0BB24F381F}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{4E15CB46-6B0A-4571-8B4A-DA0BB24F381F}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{8B86BFC7-FAF7-40C0-9BAD-BEED6424F003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{8B86BFC7-FAF7-40C0-9BAD-BEED6424F003}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{8B86BFC7-FAF7-40C0-9BAD-BEED6424F003}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{8B86BFC7-FAF7-40C0-9BAD-BEED6424F003}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {E9C5868A-D395-43B0-BE41-7EA51824F324}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Experimental.System
2+
{
3+
internal static class AssemblyRef
4+
{
5+
internal const string SystemDesign = "System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
6+
7+
internal const string SystemDrawing = "System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
8+
}
9+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<RootNamespace>Experimental.System</RootNamespace>
6+
<PackageId>Experimental.System.Messaging</PackageId>
7+
<Version>1.0.0</Version>
8+
<Authors>Original author: Microsoft Corporation, Code ported by: Jung Hyun, Nam</Authors>
9+
<Company>Microsoft Corporation</Company>
10+
<Product>Experimental.System.Messaging (for .NET Core)</Product>
11+
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
12+
<PackageTags>MSMQ,Fork,Experimental</PackageTags>
13+
<Description>This package is a counterfeit of the .NET Framework version System.Messaging assembly for .NET Core applications running on Windows Client and Windows Server. It is provided for development convenience. Do not use this package if Microsoft officially releases this package again. Also, once it is released, you should migrate the code to the new package.
14+
15+
The source code for this package is excerpted from the .NET Framework reference source code.</Description>
16+
<PackageLicenseUrl>https://referencesource.microsoft.com/license.html</PackageLicenseUrl>
17+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
18+
<PackageReleaseNotes>This version of the System.Messaging package excludes all advanced features such as code access security, execute permissions, and Active Directory integration. I released the package keeping in mind the minimal use of Message Queuing communication facilities. Please confirm whether it is suitable for actual use through unit test and integration test.</PackageReleaseNotes>
19+
<PackageProjectUrl>https://referencesource.microsoft.com/#System.Messaging</PackageProjectUrl>
20+
<RepositoryUrl>https://github.com/krazure/Experimental.System.Messaging</RepositoryUrl>
21+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
22+
</PropertyGroup>
23+
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
25+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
26+
<DocumentationFile>bin\Release\netstandard2.0\Experimental.System.Messaging.xml</DocumentationFile>
27+
<WarningLevel>2</WarningLevel>
28+
</PropertyGroup>
29+
30+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
31+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
32+
<DocumentationFile>bin\Debug\netstandard2.0\Experimental.System.Messaging.xml</DocumentationFile>
33+
<WarningLevel>2</WarningLevel>
34+
</PropertyGroup>
35+
36+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Experimental.System
2+
{
3+
internal static class ExternDll
4+
{
5+
public const string Advapi32 = "advapi32.dll";
6+
7+
public const string Mqrt = "mqrt.dll";
8+
9+
public const string Ole32 = "ole32.dll";
10+
11+
public const string Kernel32 = "kernel32.dll";
12+
}
13+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AcknowledgeTypes.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// </copyright>
5+
//------------------------------------------------------------------------------
6+
7+
using Experimental.System.Messaging.Interop;
8+
using System;
9+
10+
namespace Experimental.System.Messaging
11+
{
12+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes"]/*' />
13+
/// <devdoc>
14+
/// <para>
15+
/// Specifies what kind of acknowledgment to get after sending a message.
16+
/// </para>
17+
/// </devdoc>
18+
[Flags]
19+
public enum AcknowledgeTypes
20+
{
21+
22+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.PositiveArrival"]/*' />
23+
/// <devdoc>
24+
/// <para>
25+
/// Use this value to request a positive acknowledgment when the message
26+
/// reaches the queue.
27+
/// </para>
28+
/// </devdoc>
29+
PositiveArrival = NativeMethods.ACKNOWLEDGE_POSITIVE_ARRIVAL,
30+
31+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.PositiveReceive"]/*' />
32+
/// <devdoc>
33+
/// <para>
34+
/// Use this value to request a positive acknowledgment when the message
35+
/// is successfully retrieved from the queue.
36+
/// </para>
37+
/// </devdoc>
38+
PositiveReceive = NativeMethods.ACKNOWLEDGE_POSITIVE_RECEIVE,
39+
40+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.NegativeReceive"]/*' />
41+
/// <devdoc>
42+
/// <para>
43+
/// Use this value to request a negative acknowledgment when the message fails
44+
/// to be retrieved from the queue.
45+
/// </para>
46+
/// </devdoc>
47+
NegativeReceive = NativeMethods.ACKNOWLEDGE_NEGATIVE_RECEIVE,
48+
49+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.None"]/*' />
50+
/// <devdoc>
51+
/// <para>
52+
/// Use this value to request no acknowledgment messages (positive or negative) to be posted.
53+
/// </para>
54+
/// </devdoc>
55+
None = NativeMethods.ACKNOWLEDGE_NONE,
56+
57+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.NotAcknowledgeReachQueue"]/*' />
58+
/// <devdoc>
59+
/// <para>
60+
/// Use this value to request a negative acknowledgment when the message cannot
61+
/// reach the queue. This can happen when the time-to-reach-queue
62+
/// timer expires, or a message cannot be authenticated.
63+
/// </para>
64+
/// </devdoc>
65+
NotAcknowledgeReachQueue = NativeMethods.ACKNOWLEDGE_NEGATIVE_ARRIVAL,
66+
67+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.NotAcknowledgeReceive"]/*' />
68+
/// <devdoc>
69+
/// <para>
70+
/// Use this value to request a negative acknowledgment when an error occurs and
71+
/// the message cannot be retrieved from the queue before its
72+
/// time-to-be-received timer expires.
73+
/// </para>
74+
/// </devdoc>
75+
NotAcknowledgeReceive = NegativeReceive |
76+
NativeMethods.ACKNOWLEDGE_NEGATIVE_ARRIVAL,
77+
78+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.FullReachQueue"]/*' />
79+
/// <devdoc>
80+
/// <para>
81+
/// Use this value
82+
/// to request full acknowledgment (positive or negative) depending
83+
/// on whether or not the message reaches the queue.
84+
/// This can happen when the time-to-reach-queue timer expires,
85+
/// or a message cannot be authenticated.
86+
/// </para>
87+
/// </devdoc>
88+
FullReachQueue = NotAcknowledgeReachQueue |
89+
PositiveArrival,
90+
91+
/// <include file='doc\AcknowledgeTypes.uex' path='docs/doc[@for="AcknowledgeTypes.FullReceive"]/*' />
92+
/// <devdoc>
93+
/// <para>
94+
/// Use this value to request full acknowledgment (positive or negative) depending
95+
/// on whether or not the message is retrieved from the queue
96+
/// before its time-to-be-received timer expires.
97+
/// </para>
98+
/// </devdoc>
99+
FullReceive = NotAcknowledgeReceive |
100+
PositiveReceive,
101+
102+
}
103+
}

0 commit comments

Comments
 (0)