Skip to content

Commit 3888f28

Browse files
committed
initial upload
1 parent 3f889e0 commit 3888f28

37 files changed

+2118
-3
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ rcf/
181181
# Windows Store app package directories and files
182182
AppPackages/
183183
BundleArtifacts/
184-
Package.StoreAssociation.xml
185-
_pkginfo.txt
186184

187185
# Visual Studio cache files
188186
# files ending in .cache can be ignored

IntergrationMessaging.sln

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26430.6
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessageQueue.Messaging", "MessageQueue.Messaging\MessageQueue.Messaging.csproj", "{E1939D37-FD0C-4D10-8E91-B4BC25D7028E}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Handlers", "Handlers", "{91B9C650-1FFC-4B19-A669-8F4DD8F06745}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessageQueue.Handler", "MessageQueue.Handler\MessageQueue.Handler.csproj", "{D2A07778-7118-44BC-80FD-2C164D6C6234}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessageQueue.Messaging.Test", "MessageQueue.Messaging.Test\MessageQueue.Messaging.Test.csproj", "{8E6BAB04-E3A8-4379-A9A8-700AF0A153A1}"
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|Any CPU = Debug|Any CPU
17+
Release|Any CPU = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{E1939D37-FD0C-4D10-8E91-B4BC25D7028E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{E1939D37-FD0C-4D10-8E91-B4BC25D7028E}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{E1939D37-FD0C-4D10-8E91-B4BC25D7028E}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{E1939D37-FD0C-4D10-8E91-B4BC25D7028E}.Release|Any CPU.Build.0 = Release|Any CPU
24+
{D2A07778-7118-44BC-80FD-2C164D6C6234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{D2A07778-7118-44BC-80FD-2C164D6C6234}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{D2A07778-7118-44BC-80FD-2C164D6C6234}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{D2A07778-7118-44BC-80FD-2C164D6C6234}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{8E6BAB04-E3A8-4379-A9A8-700AF0A153A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{8E6BAB04-E3A8-4379-A9A8-700AF0A153A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{8E6BAB04-E3A8-4379-A9A8-700AF0A153A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{8E6BAB04-E3A8-4379-A9A8-700AF0A153A1}.Release|Any CPU.Build.0 = Release|Any CPU
32+
EndGlobalSection
33+
GlobalSection(SolutionProperties) = preSolution
34+
HideSolutionNode = FALSE
35+
EndGlobalSection
36+
GlobalSection(NestedProjects) = preSolution
37+
{D2A07778-7118-44BC-80FD-2C164D6C6234} = {91B9C650-1FFC-4B19-A669-8F4DD8F06745}
38+
EndGlobalSection
39+
EndGlobal

MessageQueue.Handler/App.config

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<section name="messageQueue.messaging" type="MessageQueue.Messaging.Configuration.MessagingConfiguration, MessageQueue.Messaging"></section>
5+
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
6+
</configSections>
7+
<messageQueue.messaging configSource="Messaging.config" />
8+
<startup>
9+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
10+
</startup>
11+
12+
<runtime>
13+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
14+
<dependentAssembly>
15+
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
16+
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
17+
</dependentAssembly>
18+
</assemblyBinding>
19+
</runtime>
20+
21+
<appSettings>
22+
<add key="listenOnQueueName" value="doesuserexist"/>
23+
</appSettings>
24+
25+
<log4net>
26+
<appender name="debug" type="log4net.Appender.DebugAppender">
27+
<layout type="log4net.Layout.PatternLayout">
28+
<conversionPattern value="%m%n" />
29+
</layout>
30+
</appender>
31+
<appender name="console" type="log4net.Appender.ConsoleAppender">
32+
<layout type="log4net.Layout.PatternLayout">
33+
<conversionPattern value="%m%n" />
34+
</layout>
35+
</appender>
36+
<appender name="rollingLog" type="log4net.Appender.RollingFileAppender">
37+
<file type="log4net.Util.PatternString" value="MessageQueue.Handler.log" />
38+
<appendToFile value="true" />
39+
<rollingStyle value="Size" />
40+
<datePattern value="yyyyMMdd" />
41+
<maxSizeRollBackups value="3" />
42+
<maximumFileSize value="1MB" />
43+
<layout type="log4net.Layout.PatternLayout">
44+
<conversionPattern value="%date [%thread] %-5level %logger - %m%n" />
45+
</layout>
46+
</appender>
47+
<root>
48+
<level value="DEBUG" />
49+
<!--use these appenders and their settings from above-->
50+
<appender-ref ref="debug" />
51+
<appender-ref ref="console" />
52+
<appender-ref ref="rollingLog" />
53+
</root>
54+
<logger name="MessageQueue.Handler">
55+
<level value="DEBUG" />
56+
</logger>
57+
</log4net>
58+
59+
</configuration>

MessageQueue.Handler/Log.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using log4net;
2+
using log4net.Config;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace MessageQueue.Handler
10+
{
11+
public static class Log
12+
{
13+
private static ILog _Log;
14+
15+
static Log()
16+
{
17+
XmlConfigurator.Configure();
18+
_Log = LogManager.GetLogger( "MessageQueue.Handler" );
19+
}
20+
21+
public static void WriteLine( string format, params object[] args )
22+
{
23+
_Log.Debug( string.Format( format, args ) );
24+
}
25+
}
26+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{D2A07778-7118-44BC-80FD-2C164D6C6234}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>MessageQueue.Handler</RootNamespace>
10+
<AssemblyName>MessageQueue.Handler</AssemblyName>
11+
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<PropertyGroup>
35+
<ApplicationManifest>app.manifest</ApplicationManifest>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
39+
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
40+
</Reference>
41+
<Reference Include="System" />
42+
<Reference Include="System.Configuration" />
43+
<Reference Include="System.Core" />
44+
<Reference Include="System.Xml.Linq" />
45+
<Reference Include="System.Data.DataSetExtensions" />
46+
<Reference Include="Microsoft.CSharp" />
47+
<Reference Include="System.Data" />
48+
<Reference Include="System.Net.Http" />
49+
<Reference Include="System.Xml" />
50+
<Reference Include="Topshelf, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
51+
<HintPath>..\packages\Topshelf.4.0.3\lib\net452\Topshelf.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Topshelf.Log4Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
54+
<HintPath>..\packages\Topshelf.Log4Net.4.0.3\lib\net452\Topshelf.Log4Net.dll</HintPath>
55+
</Reference>
56+
</ItemGroup>
57+
<ItemGroup>
58+
<Compile Include="Log.cs" />
59+
<Compile Include="Program.cs" />
60+
<Compile Include="Properties\AssemblyInfo.cs" />
61+
<Compile Include="QueueListener.cs" />
62+
</ItemGroup>
63+
<ItemGroup>
64+
<None Include="App.config" />
65+
<None Include="app.manifest" />
66+
<None Include="packages.config" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<ProjectReference Include="..\MessageQueue.Messaging\MessageQueue.Messaging.csproj">
70+
<Project>{E1939D37-FD0C-4D10-8E91-B4BC25D7028E}</Project>
71+
<Name>MessageQueue.Messaging</Name>
72+
</ProjectReference>
73+
</ItemGroup>
74+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
75+
</Project>

MessageQueue.Handler/Program.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+

2+
using System;
3+
using System.Diagnostics;
4+
using Topshelf;
5+
6+
namespace MessageQueue.Handler
7+
{
8+
class Program
9+
{
10+
private static void Main( string[] args )
11+
{
12+
try
13+
{
14+
Debug.WriteLine( "Starting..." );
15+
16+
string listenOnQueueName = null;
17+
18+
19+
HostFactory.Run( hostConfig =>
20+
{
21+
22+
hostConfig.AddCommandLineDefinition( "listenOnQueueName", q => { listenOnQueueName = q; } );
23+
hostConfig.ApplyCommandLine();
24+
25+
Debug.WriteLine( $"listenOnQueueName={ listenOnQueueName}" );
26+
27+
28+
hostConfig.Service<QueueListener>(
29+
sc =>
30+
{
31+
32+
sc.ConstructUsing( () => new QueueListener() );
33+
34+
sc.WhenStarted( s => s.Start( listenOnQueueName ) );
35+
36+
sc.WhenStopped( s => s.Stop() );
37+
} );
38+
39+
40+
hostConfig.SetServiceName( "MessageQueue.Handler" );
41+
42+
hostConfig.UseLog4Net();
43+
44+
hostConfig.RunAsLocalSystem();
45+
} );
46+
}
47+
catch ( Exception ex )
48+
{
49+
Debug.WriteLine( "Error running host: {0}", ex );
50+
}
51+
}
52+
}
53+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("MessageQueue.Handler")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("MessageQueue.Handler")]
13+
[assembly: AssemblyCopyright("Copyright © 2017")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("d2a07778-7118-44bc-80fd-2c164d6c6234")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

MessageQueue.Handler/QueueListener.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+

2+
using MessageQueue.Messaging.Specification;
3+
using System.Threading;
4+
5+
6+
namespace MessageQueue.Handler
7+
{
8+
public sealed class QueueListener
9+
{
10+
private CancellationTokenSource _cancellationTokenSource;
11+
12+
public void Start( string queueName )
13+
{
14+
15+
}
16+
17+
public void Stop()
18+
{
19+
_cancellationTokenSource.Cancel();
20+
}
21+
22+
private void StartListening( string name, MessagePattern pattern )
23+
{
24+
}
25+
26+
27+
}
28+
}

0 commit comments

Comments
 (0)